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
|
||
|
'';
|
||
|
}
|