nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ buildRedist, lib }:
2buildRedist (finalAttrs: {
3 redistName = "cuda";
4 pname = "cuda_nvml_dev";
5
6 outputs = [
7 "out"
8 "dev"
9 "include"
10 "stubs"
11 ];
12
13 # TODO(@connorbaker): Add a setup hook to the outputStubs output to automatically replace rpath entries
14 # containing the stubs output with the driver link.
15
16 allowFHSReferences = true;
17
18 # Include the stubs output since it provides libnvidia-ml.so.
19 propagatedBuildOutputs = lib.optionals (lib.elem "stubs" finalAttrs.outputs) [ "stubs" ];
20
21 # TODO: Some programs try to link against libnvidia-ml.so.1, so make an alias.
22 # Not sure about the version number though!
23 postInstall = lib.optionalString (lib.elem "stubs" finalAttrs.outputs) ''
24 pushd "''${!outputStubs:?}/lib/stubs" >/dev/null
25 if [[ -f libnvidia-ml.so && ! -f libnvidia-ml.so.1 ]]; then
26 nixLog "creating versioned symlink for libnvidia-ml.so stub"
27 ln -sr libnvidia-ml.so libnvidia-ml.so.1
28 fi
29 if [[ -f libnvidia-ml.a && ! -f libnvidia-ml.a.1 ]]; then
30 nixLog "creating versioned symlink for libnvidia-ml.a stub"
31 ln -sr libnvidia-ml.a libnvidia-ml.a.1
32 fi
33 popd >/dev/null
34 '';
35
36 meta = {
37 description = "C-based programmatic interface for monitoring and managing various states within Data Center GPUs";
38 longDescription = ''
39 The NVIDIA Management Library (NVML) is a C-based programmatic interface for monitoring and managing various
40 states within Data Center GPUs. It is intended to be a platform for building 3rd party applications, and is also
41 the underlying library for the NVIDIA-supported nvidia-smi tool.
42 '';
43 homepage = "https://developer.nvidia.com/management-library-nvml";
44 };
45})