-
-
Save akaihola/1332204faf10df7956ea6d1702bfae85 to your computer and use it in GitHub Desktop.
Nix Flake for non-FHS Python virtualenv using uv. As an example, install Jupyter and Pandas.
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.jupyter | |
python3Packages.pandas | |
python3Packages.pip | |
python3Packages.virtualenv | |
pythonManylinuxPackages.manylinux2014Package | |
uv | |
]; | |
shellHook = '' | |
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib.outPath}/lib:${pkgs.pythonManylinuxPackages.manylinux2014Package}/lib:$LD_LIBRARY_PATH"; | |
test -d .nix-venv || uv venv --python=${pkgs.python3.interpreter} .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