diff --git a/pkgs/development/cuda-modules/_cuda/lib/default.nix b/pkgs/development/cuda-modules/_cuda/lib/default.nix index 3aa3aab7dafb..376abcd27f7b 100644 --- a/pkgs/development/cuda-modules/_cuda/lib/default.nix +++ b/pkgs/development/cuda-modules/_cuda/lib/default.nix @@ -33,6 +33,7 @@ getNixSystems getRedistSystem mkRedistUrl + selectManifests ; # See ./strings.nix for documentation. diff --git a/pkgs/development/cuda-modules/_cuda/lib/redist.nix b/pkgs/development/cuda-modules/_cuda/lib/redist.nix index 613c10d88c32..3138097c1694 100644 --- a/pkgs/development/cuda-modules/_cuda/lib/redist.nix +++ b/pkgs/development/cuda-modules/_cuda/lib/redist.nix @@ -237,4 +237,34 @@ ) ++ [ relativePath ] ); + + /** + Function which accepts an attribute set mapping redistributable name to version and retrieves the corresponding + collection of manifests from `_cuda.manifests`. Additionally, the version provided is used to populate the + `release_label` field in the corresponding manifest if it is missing. + + It is an error to provide a redistributable name and version for which there is no corresponding manifest. + + # Type + + ``` + selectManifests :: (versions :: AttrSet RedistName Version) -> AttrSet RedistName Manifest + ``` + + # Inputs + + `versions` + + : An attribute set mapping redistributable name to manifest version + */ + selectManifests = lib.mapAttrs ( + name: version: + let + manifest = _cuda.manifests.${name}.${version}; + in + manifest + // { + release_label = manifest.release_label or version; + } + ); }