-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathdev_env_builder.nix
49 lines (46 loc) · 1.35 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
48
49
{ nixpkgs, system, cudaSupport ? false, rocmSupport ? false
, vulkanSupport ? false }:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
config.cudaSupport = cudaSupport;
config.rocmSupport = rocmSupport;
config.vulkanSupport = vulkanSupport;
};
in pkgs.mkShell {
name = "impureEvoXPythonEnv";
venvDir = "./.venv";
nativeBuildInputs = with pkgs; [
(python313.withPackages (py-pkgs:
with py-pkgs; [
# 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
(if cudaSupport then
torchWithCuda
else if rocmSupport then
torchWithRocm
else if vulkanSupport then
torchWithVulkan
else
torch)
torchvision
]))
pre-commit
ruff
];
# Run this command, only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
'';
# 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
'';
}