push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
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):

View File

@@ -0,0 +1,64 @@
{
lib,
fetchPypi,
buildPythonPackage,
replaceVars,
addDriverRunpath,
setuptools,
cudaPackages,
nvidia-ml-py,
}:
buildPythonPackage rec {
pname = "nvidia-ml-py";
version = "13.580.82";
pyproject = true;
src = fetchPypi {
pname = "nvidia_ml_py";
inherit version;
hash = "sha256-DAKIBdxToOKmmF6oAYiBl3Zawu+PHJ4pp78NNhal78c=";
};
patches = [
(replaceVars ./0001-locate-libnvidia-ml.so.1-on-NixOS.patch {
inherit (addDriverRunpath) driverLink;
})
];
build-system = [
setuptools
];
# no tests
doCheck = false;
pythonImportsCheck = [ "pynvml" ];
passthru.tests.tester-nvmlInit =
cudaPackages.writeGpuTestPython { libraries = [ nvidia-ml-py ]; }
''
from pynvml import (
nvmlInit,
nvmlSystemGetDriverVersion,
nvmlDeviceGetCount,
nvmlDeviceGetHandleByIndex,
nvmlDeviceGetName,
)
nvmlInit()
print(f"Driver Version: {nvmlSystemGetDriverVersion()}")
for i in range(nvmlDeviceGetCount()):
handle = nvmlDeviceGetHandleByIndex(i)
print(f"Device {i} : {nvmlDeviceGetName(handle)}")
'';
meta = {
description = "Python Bindings for the NVIDIA Management Library";
homepage = "https://pypi.org/project/nvidia-ml-py";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}