mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
18 lines
823 B
Diff
18 lines
823 B
Diff
diff --git a/pynvml.py b/pynvml.py
|
|
index 9a424de..669afe0 100644
|
|
--- a/pynvml.py
|
|
+++ b/pynvml.py
|
|
@@ -1676,7 +1676,11 @@ def _LoadNvmlLibrary():
|
|
nvmlLib = CDLL(os.path.join(os.getenv("ProgramFiles", "C:/Program Files"), "NVIDIA Corporation/NVSMI/nvml.dll"))
|
|
else:
|
|
# assume linux
|
|
- nvmlLib = CDLL("libnvidia-ml.so.1")
|
|
+ try:
|
|
+ nvmlLib = CDLL("libnvidia-ml.so.1")
|
|
+ except OSError:
|
|
+ # Assume NixOS
|
|
+ nvmlLib = CDLL("@driverLink@/lib/libnvidia-ml.so.1")
|
|
except OSError as ose:
|
|
_nvmlCheckReturn(NVML_ERROR_LIBRARY_NOT_FOUND)
|
|
if (nvmlLib == None):
|