-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
44 lines (37 loc) · 986 Bytes
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
with import <nixpkgs> { };
let
pythonPackages = python313Packages;
pythonVenvDir = ".local/${pythonPackages.python.name}";
envPackages = [
gitMinimal
];
preInstallPypiPackages = [
"blue"
"mypy"
"pylama"
"tox"
"ipykernel"
];
in mkShell {
name = "pythonProjectDevEnv";
venvDir = pythonVenvDir;
buildInputs = with pythonPackages; [
python
venvShellHook
] ++ envPackages;
postVenvCreation = let
toPypiInstall = lib.concatStringsSep " " preInstallPypiPackages;
in ''
unset SOURCE_DATE_EPOCH # allow pip to install wheels
PIP_DISABLE_PIP_VERSION_CHECK=1 pip install ${toPypiInstall}
'';
postShellHook = ''
# fix for cython and ipython
export LD_LIBRARY_PATH=${lib.makeLibraryPath [stdenv.cc.cc]}
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
export PIP_DISABLE_PIP_VERSION_CHECK=1
# upgrade venv if python package was updated
python -m venv --upgrade ${pythonVenvDir}
'';
}