Evie Litherland-Smith
e6873dbd77
Just import, optionally changing python version or adding extra packages (e.g. poetry) to the shell Update default python env Remove pyshell template from Emacs templates due to new change
32 lines
651 B
Nix
32 lines
651 B
Nix
{
|
|
pkgs ? import <nixpkgs> { },
|
|
python3 ? pkgs.python3,
|
|
extraPackages ? with pkgs; [ uv ],
|
|
}:
|
|
let
|
|
inherit (pkgs) lib;
|
|
ldlibs = lib.makeLibraryPath (
|
|
with pkgs;
|
|
[
|
|
stdenv.cc.cc
|
|
glibc
|
|
zlib
|
|
zstd
|
|
]
|
|
);
|
|
pythonWrapped = pkgs.symlinkJoin {
|
|
name = "python";
|
|
paths = [ python3 ];
|
|
buildInputs = [ pkgs.makeWrapper ];
|
|
postBuild = ''
|
|
for file in $out/bin/*; do wrapProgram "$file" --prefix LD_LIBRARY_PATH : "${ldlibs}"; done
|
|
'';
|
|
};
|
|
in
|
|
pkgs.mkShellNoCC {
|
|
packages = [ pythonWrapped ] ++ extraPackages;
|
|
shellHook = ''
|
|
[ -f .venv/bin/activate ] && source .venv/bin/activate
|
|
'';
|
|
}
|