Files
nixpkgs/pkgs/development/python-modules/py3nvml/default.nix
Martin Weinelt c5aa1c13d8 python3Packages.py3nvml: fix, refactor, modernize
Modernizes the package and patches the CDLL lookup to look into our
driverLink library path to find libnvidia-ml.so.1.
2026-02-08 04:32:08 +01:00

45 lines
1.0 KiB
Nix

{
lib,
addDriverRunpath,
buildPythonPackage,
fetchFromGitHub,
setuptools,
xmltodict,
}:
buildPythonPackage (finalAttrs: {
pname = "py3nvml";
version = "0.2.7";
pyproject = true;
src = fetchFromGitHub {
owner = "fbcotter";
repo = "py3nvml";
tag = finalAttrs.version;
hash = "sha256-NZHpjUFeByhe290R9QWZHsVEtwScP5I3LXRh9OQIUgQ=";
};
postPatch = ''
substituteInPlace py3nvml/py3nvml.py \
--replace-fail "libnvidia-ml.so.1" "${addDriverRunpath.driverLink}/lib/libnvidia-ml-so.1"
'';
build-system = [ setuptools ];
dependencies = [ xmltodict ];
pythonImportsCheck = [ "py3nvml" ];
meta = {
changelog = "https://github.com/fbcotter/py3nvml/releases/tag/${finalAttrs.src.tag}";
description = "Python 3 Bindings for the NVIDIA Management Library";
mainProgram = "py3smi";
homepage = "https://github.com/fbcotter/py3nvml";
license = with lib.licenses; [
bsd3
bsd2
];
maintainers = with lib.maintainers; [ happysalada ];
};
})