Skip to content

Instantly share code, notes, and snippets.

@dwt
Created October 2, 2024 20:21
Show Gist options
  • Save dwt/26d939868315724999d5169d09297e11 to your computer and use it in GitHub Desktop.
Save dwt/26d939868315724999d5169d09297e11 to your computer and use it in GitHub Desktop.
Workaround to get closed source python ibm_db package working in nix environment
{ pkgs ? import <nixpkgs> {} }:
let
rosettaPkgs =
if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64
then pkgs.pkgsx86_64Darwin
else pkgs;
in
pkgs.mkShell {
buildInputs = [
rosettaPkgs.stdenv.cc.cc.lib
rosettaPkgs.python312Full
rosettaPkgs.gcc14
];
shellHook = ''
# export DYLD_FALLBACK_LIBRARY_PATH="${rosettaPkgs.gcc14.cc.lib}/lib:$DYLD_FALLBACK_LIBRARY_PATH"
if test ! -d venv ; then
${rosettaPkgs.python312Full}/bin/python3 -m venv venv
source venv/bin/activate
pip install ibm_db
fi
source venv/bin/activate
python -c "import ibm_db"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment