_cuda.extensions: make overriding all CUDA package sets easier

Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
(cherry picked from commit 36d409bc3a)
This commit is contained in:
Connor Baker
2025-05-13 17:30:40 +00:00
committed by github-actions[bot]
parent d028c1cb81
commit c2c335d15e
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}