From bd217ed50dc6775ee47a4cffe103d5e9c2f359cd Mon Sep 17 00:00:00 2001 From: Connor Baker Date: Thu, 23 Oct 2025 14:04:06 -0700 Subject: [PATCH] _cuda.lib.selectManifests: init Signed-off-by: Connor Baker --- .../cuda-modules/_cuda/lib/default.nix | 1 + .../cuda-modules/_cuda/lib/redist.nix | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) 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; + } + ); }