template patch with addOpenGLRunpath

This commit is contained in:
David Wilemski 2023-01-07 16:44:45 +00:00
parent 27513ed374
commit 7650f5f86f
2 changed files with 7 additions and 2 deletions

View File

@ -11,7 +11,7 @@ index 56d908f..1de0b97 100644
+ nvmlLib = CDLL("libnvidia-ml.so.1")
+ except OSError:
+ # assume NixOS
+ nvmlLib = CDLL("/run/opengl-driver/lib/libnvidia-ml.so.1")
+ nvmlLib = CDLL("@driverLink@/lib/libnvidia-ml.so.1")
except OSError as ose:
_nvmlCheckReturn(NVML_ERROR_LIBRARY_NOT_FOUND)
if (nvmlLib == None):

View File

@ -1,8 +1,10 @@
{ lib
, buildPythonPackage
, fetchPypi
, substituteAll
, pythonOlder
, cudatoolkit
, addOpenGLRunpath
}:
buildPythonPackage rec {
@ -16,7 +18,10 @@ buildPythonPackage rec {
};
patches = [
./0001-locate-libnvidia-ml.so.1-on-NixOS.patch
(substituteAll {
src = ./0001-locate-libnvidia-ml.so.1-on-NixOS.patch;
inherit (addOpenGLRunpath) driverLink;
})
];
propagatedBuildInputs = [ cudatoolkit ];