-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
54 lines (49 loc) · 1.51 KB
/
flake.nix
File metadata and controls
54 lines (49 loc) · 1.51 KB
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
{
description = "A flake providing a dev shell for Numba with CUDA without installing Numba via nix. Also supports PyTorch yet being minimal for Numba with CUDA.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux"; # Adjust if needed
pkgs = import nixpkgs {
system = system;
config.allowUnfree = true;
};
cudatookit-with-cudart-to-lib64 = pkgs.symlinkJoin {
name = "cudatoolkit";
paths = with pkgs.cudaPackages; [
cudatoolkit
(pkgs.lib.getStatic cuda_cudart)
];
postBuild = ''
ln -s $out/lib $out/lib64
'';
};
in
{
devShells.${system}.default = pkgs.mkShell {
shellHook = ''
# Required for both PyTorch and Numba to find CUDA
export CUDA_PATH=${cudatookit-with-cudart-to-lib64}
# Required for both PyTorch and Numba, adds necessary paths for dynamic linking
export LD_LIBRARY_PATH=${
pkgs.lib.makeLibraryPath [
"/run/opengl-driver" # Needed to find libGL.so, required by both PyTorch and Numba
]
}:$LD_LIBRARY_PATH
export LIBRARY_PATH=${
pkgs.lib.makeLibraryPath [
pkgs.graphviz
]
}:$LIBRARY_PATH
export C_INCLUDE_PATH=${
pkgs.lib.makeIncludePath [
pkgs.graphviz
]
}:$C_INCLUDE_PATH
'';
};
};
}