biome: 1.9.2 -> 1.9.3 (#349335)
[NixPkgs.git] / pkgs / development / python-modules / nvidia-ml-py / 0001-locate-libnvidia-ml.so.1-on-NixOS.patch
blob79f3e8f705c9b5cc853654acfc9e6a743f27c3b0
1 diff --git a/pynvml.py b/pynvml.py
2 index 9a424de..669afe0 100644
3 --- a/pynvml.py
4 +++ b/pynvml.py
5 @@ -1676,7 +1676,11 @@ def _LoadNvmlLibrary():
6 nvmlLib = CDLL(os.path.join(os.getenv("ProgramFiles", "C:/Program Files"), "NVIDIA Corporation/NVSMI/nvml.dll"))
7 else:
8 # assume linux
9 - nvmlLib = CDLL("libnvidia-ml.so.1")
10 + try:
11 + nvmlLib = CDLL("libnvidia-ml.so.1")
12 + except OSError:
13 + # Assume NixOS
14 + nvmlLib = CDLL("@driverLink@/lib/libnvidia-ml.so.1")
15 except OSError as ose:
16 _nvmlCheckReturn(NVML_ERROR_LIBRARY_NOT_FOUND)
17 if (nvmlLib == None):