diff --git a/pkgs/development/python-modules/pynvml/0001-locate-libnvidia-ml.so.1-on-NixOS.patch b/pkgs/development/python-modules/pynvml/0001-locate-libnvidia-ml.so.1-on-NixOS.patch index ada9eecf8db6..48727de2516a 100644 --- a/pkgs/development/python-modules/pynvml/0001-locate-libnvidia-ml.so.1-on-NixOS.patch +++ b/pkgs/development/python-modules/pynvml/0001-locate-libnvidia-ml.so.1-on-NixOS.patch @@ -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): diff --git a/pkgs/development/python-modules/pynvml/default.nix b/pkgs/development/python-modules/pynvml/default.nix index d67208490ac7..8f02bcdbe816 100644 --- a/pkgs/development/python-modules/pynvml/default.nix +++ b/pkgs/development/python-modules/pynvml/default.nix @@ -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 ];