_cuda.extensions: make overriding all CUDA package sets easier

Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
This commit is contained in:
Connor Baker
2025-05-13 17:30:40 +00:00
parent b0f64f56be
commit 36d409bc3a
4 changed files with 21 additions and 0 deletions

View File

@@ -95,6 +95,22 @@ final: prev: {
}
```
## Extending CUDA package sets {#cuda-extending-cuda-package-sets}
CUDA package sets are scopes, so they provide the usual `overrideScope` attribute for overriding package attributes (see the note about `cudaMajorMinorVersion` and `_cuda` in [Configuring CUDA package sets](#cuda-configuring-cuda-package-sets)).
Inspired by `pythonPackagesExtensions`, the `_cuda.extensions` attribute is a list of extensions applied to every version of the CUDA package set, allowing modification of all versions of the CUDA package set without having to know what they are or find a way to enumerate and modify them explicitly. As an example, disabling `cuda_compat` across all CUDA package sets can be accomplished with this overlay:
```nix
final: prev: {
_cuda = prev._cuda.extend (
_: prevAttrs: {
extensions = prevAttrs.extensions ++ [ (_: _: { cuda_compat = null; }) ];
}
);
}
```
## Using cudaPackages {#cuda-using-cudapackages}
::: {.caution}

View File

@@ -35,6 +35,9 @@
"cuda-docker-podman": [
"index.html#cuda-docker-podman"
],
"cuda-extending-cuda-package-sets": [
"index.html#cuda-extending-cuda-package-sets"
],
"cuda-package-set-maintenance": [
"index.html#cuda-package-set-maintenance",
"index.html#adding-a-new-cuda-release"

View File

@@ -22,6 +22,7 @@ lib.fixedPoints.makeExtensible (final: {
inherit (final) bootstrapData db;
inherit lib;
};
extensions = [ ]; # Extensions applied to every CUDA package set.
fixups = import ./fixups { inherit lib; };
lib = import ./lib {
_cuda = final;

View File

@@ -209,6 +209,7 @@ let
++ lib.optionals config.allowAliases [
(import ../development/cuda-modules/aliases.nix { inherit lib; })
]
++ _cuda.extensions
);
cudaPackages = customisation.makeScope newScope (