1
- { nixpkgs
2
- , system
3
- , cudaSupport
4
- , rocmSupport
5
- } :
1
+ { nixpkgs , system , cudaSupport ? false , rocmSupport ? false
2
+ , vulkanSupport ? false } :
6
3
let
7
4
pkgs = import nixpkgs {
8
5
inherit system ;
9
6
config . allowUnfree = true ;
10
7
config . cudaSupport = cudaSupport ;
11
8
config . rocmSupport = rocmSupport ;
9
+ config . vulkanSupport = vulkanSupport ;
12
10
} ;
13
- pythonPackages = pkgs . python3Packages ;
14
- in
15
- pkgs . mkShell rec {
11
+ in pkgs . mkShell {
16
12
name = "impureEvoXPythonEnv" ;
17
13
venvDir = "./.venv" ;
18
- buildInputs = with pythonPackages ; [
19
- python
20
- # This executes some shell code to initialize a venv in $venvDir before
21
- # dropping into the shell
22
- venvShellHook
14
+ nativeBuildInputs = with pkgs ; [
15
+ ( python313 . withPackages ( py-pkgs :
16
+ with py-pkgs ; [
17
+ # This executes some shell code to initialize a venv in $venvDir before
18
+ # dropping into the shell
19
+ venvShellHook
23
20
24
- # Those are dependencies that we would like to use from nixpkgs, which will
25
- # add them to PYTHONPATH and thus make them accessible from within the venv.
26
- numpy
27
- torch
28
- torchvision
29
- ] ++ ( with pkgs ; [
21
+ # Those are dependencies that we would like to use from nixpkgs, which will
22
+ # add them to PYTHONPATH and thus make them accessible from within the venv.
23
+ numpy
24
+ ( if cudaSupport then
25
+ torchWithCuda
26
+ else if rocmSupport then
27
+ torchWithRocm
28
+ else if vulkanSupport then
29
+ torchWithVulkan
30
+ else
31
+ torch )
32
+ torchvision
33
+ ] ) )
30
34
pre-commit
31
35
ruff
32
- ] ) ;
36
+ ] ;
33
37
34
38
# Run this command, only after creating the virtual environment
35
39
postVenvCreation = ''
36
40
unset SOURCE_DATE_EPOCH
37
- pip install -e .
38
41
'' ;
39
42
40
43
# Now we can execute any commands within the virtual environment.
@@ -43,5 +46,4 @@ pkgs.mkShell rec {
43
46
# allow pip to install wheels
44
47
unset SOURCE_DATE_EPOCH
45
48
'' ;
46
-
47
49
}
0 commit comments