nixpkgs/pkgs/by-name/pr/prometheus-dcgm-exporter/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

53 lines
1.3 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, autoAddDriverRunpath
, dcgm
}:
buildGoModule rec {
pname = "dcgm-exporter";
# The first portion of this version string corresponds to a compatible DCGM
# version.
version = "3.3.5-3.4.0"; # N.B: If you change this, update dcgm as well to the matching version.
src = fetchFromGitHub {
owner = "NVIDIA";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-IOVPEK+9ogBZJYns2pTyJwHUBMN8JqG1THTJPvpCwdo=";
};
CGO_LDFLAGS = "-ldcgm";
buildInputs = [
dcgm
];
# gonvml and go-dcgm do not work with ELF BIND_NOW hardening because not all
# symbols are available on startup.
hardeningDisable = [ "bindnow" ];
vendorHash = "sha256-urKa0O8QZnM8cWjPcGVhoAWhx6fCdMmhRX0JOriRaig=";
nativeBuildInputs = [
autoAddDriverRunpath
];
# Tests try to interact with running DCGM service.
doCheck = false;
postFixup = ''
patchelf --add-needed libnvidia-ml.so "$out/bin/dcgm-exporter"
'';
meta = with lib; {
description = "NVIDIA GPU metrics exporter for Prometheus leveraging DCGM";
homepage = "https://github.com/NVIDIA/dcgm-exporter";
license = licenses.asl20;
maintainers = teams.deshaw.members;
mainProgram = "dcgm-exporter";
platforms = platforms.linux;
};
}