2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
substituteAll,
|
|
|
|
pythonOlder,
|
|
|
|
addOpenGLRunpath,
|
|
|
|
setuptools,
|
|
|
|
pytestCheckHook,
|
|
|
|
versioneer,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pynvml";
|
2023-02-22 10:55:15 +00:00
|
|
|
version = "11.5.0";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gpuopenanalytics";
|
|
|
|
repo = "pynvml";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-K3ZENjgi+TVDxr55dRK1y8SwzfgVIzcnD4oEI+KHRa4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./0001-locate-libnvidia-ml.so.1-on-NixOS.patch;
|
|
|
|
inherit (addOpenGLRunpath) driverLink;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
# unvendor versioneer
|
|
|
|
postPatch = ''
|
|
|
|
rm versioneer.py
|
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
2024-05-15 15:35:15 +00:00
|
|
|
versioneer
|
2024-04-21 15:54:59 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pynvml"
|
|
|
|
"pynvml.smi"
|
2024-04-21 15:54:59 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
# OSError: /run/opengl-driver/lib/libnvidia-ml.so.1: cannot open shared object file: No such file or directory
|
|
|
|
doCheck = false;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Python bindings for the NVIDIA Management Library";
|
2024-04-21 15:54:59 +00:00
|
|
|
homepage = "https://github.com/gpuopenanalytics/pynvml";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = [ maintainers.bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|