-
Notifications
You must be signed in to change notification settings - Fork 46
/
flake.nix
58 lines (56 loc) · 1.6 KB
/
flake.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
description = "Python venv development template";
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs_old.url = "https://github.com/NixOS/nixpkgs/archive/b4e193a23a1c5d8794794e65cabf1f1135d07fd9.tar.gz";
};
outputs = {
self,
nixpkgs,
nixpkgs_old,
utils,
...
}:
utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
pkgs_old = import nixpkgs_old {inherit system;};
pythonPackages = pkgs.python3Packages;
python37Packages = pkgs_old.python37Packages;
in {
devShells.default = pkgs.mkShell {
name = "python-venv";
venvDir = "./.venv-nixos";
buildInputs = [
pythonPackages.python
pythonPackages.venvShellHook
pythonPackages.notebook
pythonPackages.ipython
];
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements-devel.txt
'';
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
};
# python3.7 is supported because some people are still using it.
devShells.python37 = pkgs_old.mkShell {
name = "python-venv";
venvDir = "./.venv";
buildInputs = [
python37Packages.python
python37Packages.venvShellHook
];
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements-devel-python37.lock
'';
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
};
});
}