Fedir Zadniprovskyi commited on
Commit
3ac4de7
·
1 Parent(s): 93d8861

fix: cuda not working on nixos

Browse files
Files changed (1) hide show
  1. flake.nix +16 -2
flake.nix CHANGED
@@ -28,11 +28,25 @@
28
  rsync
29
  websocat
30
  uv
 
31
  ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  shellHook = ''
33
  source .venv/bin/activate
34
- export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH
35
- export LD_LIBRARY_PATH=${pkgs.zlib}/lib:$LD_LIBRARY_PATH
36
  source .env
37
  '';
38
  };
 
28
  rsync
29
  websocat
30
  uv
31
+ cudaPackages_12.cudnn_8_9
32
  ];
33
+
34
+ # https://github.com/NixOS/nixpkgs/issues/278976#issuecomment-1879685177
35
+ # NOTE: Without adding `/run/...` the following error occurs
36
+ # RuntimeError: CUDA failed with error CUDA driver version is insufficient for CUDA runtime version
37
+ #
38
+ # NOTE: sometimes it still doesn't work but rebooting the system fixes it
39
+ LD_LIBRARY_PATH = "/run/opengl-driver/lib:${
40
+ pkgs.lib.makeLibraryPath [
41
+ pkgs.cudaPackages_12.cudnn_8_9
42
+ pkgs.zlib
43
+ pkgs.stdenv.cc.cc
44
+ pkgs.openssl
45
+ ]
46
+ }";
47
+
48
  shellHook = ''
49
  source .venv/bin/activate
 
 
50
  source .env
51
  '';
52
  };