nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 cudaNamePrefix,
3 cudaPackages,
4 lib,
5 linkFarm,
6}:
7# NOTE: Because Nixpkgs, by default, allows aliases, this derivation may contain multiple entries for a single redistributable.
8let
9 redistsForPlatform = lib.filterAttrs (
10 _: value: value ? passthru.redistName && value.src or null != null
11 ) cudaPackages;
12
13 linkedWithoutLicenses = linkFarm "${cudaNamePrefix}-redists-unpacked" (
14 lib.mapAttrs (_: drv: drv.src) redistsForPlatform
15 );
16in
17linkedWithoutLicenses.overrideAttrs (prevAttrs: {
18 passthru = prevAttrs.passthru or { } // {
19 inherit redistsForPlatform;
20 };
21
22 meta = prevAttrs.meta or { } // {
23 license = lib.unique (
24 lib.concatMap (drv: lib.toList (drv.meta.license or [ ])) (lib.attrValues redistsForPlatform)
25 );
26 };
27})