-
-
Save agoose77/55d04420384cafac9b09971d4870b1f6 to your computer and use it in GitHub Desktop.
Nix Flake for non-FHS venv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | |
flake-utils.url = "github:numtide/flake-utils"; | |
}; | |
outputs = inputs @ { | |
self, | |
nixpkgs, | |
flake-utils, | |
... | |
}: | |
flake-utils.lib.eachDefaultSystem (system: let | |
pkgs = import nixpkgs {inherit system;}; | |
in { | |
devShell = pkgs.mkShell { | |
buildInputs = with pkgs; [ | |
python3 | |
python3Packages.pip | |
python3Packages.virtualenv | |
pythonManylinuxPackages.manylinux2014Package | |
cmake | |
ninja | |
imagemagick | |
]; | |
shellHook = '' | |
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib.outPath}/lib:${pkgs.pythonManylinuxPackages.manylinux2014Package}/lib:$LD_LIBRARY_PATH"; | |
test -d .nix-venv || ${pkgs.python3.interpreter} -m venv .nix-venv | |
source .nix-venv/bin/activate | |
''; | |
}; }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And to clarify for newbies, you run this with:
See also Jupyter and Python on NixOS on r/NixOS for more context.