-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathdev_env_builder.nix
47 lines (43 loc) · 1.1 KB
/
dev_env_builder.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
{ nixpkgs
, system
, cudaSupport
, rocmSupport
}:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
config.cudaSupport = cudaSupport;
config.rocmSupport = rocmSupport;
};
pythonPackages = pkgs.python3Packages;
in
pkgs.mkShell rec {
name = "impureEvoXPythonEnv";
venvDir = "./.venv";
buildInputs = with pythonPackages; [
python
# This executes some shell code to initialize a venv in $venvDir before
# dropping into the shell
venvShellHook
# Those are dependencies that we would like to use from nixpkgs, which will
# add them to PYTHONPATH and thus make them accessible from within the venv.
numpy
torch
torchvision
] ++ (with pkgs; [
pre-commit
ruff
]);
# Run this command, only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -e .
'';
# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
}