cudaPackages.tests.redists-{unpacked,installed}: include license metadata
Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
This commit is contained in:
@@ -1,17 +1,49 @@
|
||||
{
|
||||
_cuda,
|
||||
backendStdenv,
|
||||
cudaNamePrefix,
|
||||
cudaPackages,
|
||||
lib,
|
||||
linkFarm,
|
||||
tests,
|
||||
}:
|
||||
linkFarm "${cudaNamePrefix}-redists-installed" (
|
||||
lib.concatMapAttrs (
|
||||
name: attr:
|
||||
lib.optionalAttrs (attr ? passthru.redistName && attr.meta.available or false) (
|
||||
lib.genAttrs' attr.outputs (output: {
|
||||
name = "${name}-${output}";
|
||||
value = attr.${output};
|
||||
})
|
||||
)
|
||||
) cudaPackages
|
||||
# NOTE: Because Nixpkgs, by default, allows aliases, this derivation may contain multiple entries for a single redistributable.
|
||||
let
|
||||
# redists-unpacked has already found all the names of the redistributables
|
||||
availableRedistsForPlatform = lib.filterAttrs (
|
||||
_: value: value.meta.available or false
|
||||
) tests.redists-unpacked.passthru.redistsForPlatform;
|
||||
|
||||
mkOutputs =
|
||||
name: drv:
|
||||
lib.genAttrs' drv.outputs (output: {
|
||||
name = "${name}-${output}";
|
||||
value = drv.${output};
|
||||
});
|
||||
|
||||
linkedWithoutLicenses = linkFarm "${cudaNamePrefix}-redists-installed" (
|
||||
lib.concatMapAttrs mkOutputs availableRedistsForPlatform
|
||||
);
|
||||
in
|
||||
linkedWithoutLicenses.overrideAttrs (
|
||||
finalAttrs: prevAttrs: {
|
||||
passthru = prevAttrs.passthru or { } // {
|
||||
inherit availableRedistsForPlatform;
|
||||
|
||||
brokenAssertions = prevAttrs.passthru.brokenAssertions or [ ] ++ [
|
||||
{
|
||||
message = "No redists are available for the current platform (${backendStdenv.hostNixSystem}); ensure proper licenses are allowed";
|
||||
assertion = availableRedistsForPlatform != { };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
meta = prevAttrs.meta or { } // {
|
||||
broken = _cuda.lib._mkMetaBroken finalAttrs;
|
||||
license = lib.unique (
|
||||
lib.concatMap (drv: lib.toList (drv.meta.license or [ ])) (
|
||||
lib.attrValues availableRedistsForPlatform
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
)
|
||||
|
||||
@@ -4,11 +4,24 @@
|
||||
lib,
|
||||
linkFarm,
|
||||
}:
|
||||
linkFarm "${cudaNamePrefix}-redists-unpacked" (
|
||||
lib.concatMapAttrs (
|
||||
name: attr:
|
||||
lib.optionalAttrs (attr ? passthru.redistName && attr.src or null != null) {
|
||||
${name} = attr.src;
|
||||
}
|
||||
) cudaPackages
|
||||
)
|
||||
# NOTE: Because Nixpkgs, by default, allows aliases, this derivation may contain multiple entries for a single redistributable.
|
||||
let
|
||||
redistsForPlatform = lib.filterAttrs (
|
||||
_: value: value ? passthru.redistName && value.src or null != null
|
||||
) cudaPackages;
|
||||
|
||||
linkedWithoutLicenses = linkFarm "${cudaNamePrefix}-redists-unpacked" (
|
||||
lib.mapAttrs (_: drv: drv.src) redistsForPlatform
|
||||
);
|
||||
in
|
||||
linkedWithoutLicenses.overrideAttrs (prevAttrs: {
|
||||
passthru = prevAttrs.passthru or { } // {
|
||||
inherit redistsForPlatform;
|
||||
};
|
||||
|
||||
meta = prevAttrs.meta or { } // {
|
||||
license = lib.unique (
|
||||
lib.concatMap (drv: lib.toList (drv.meta.license or [ ])) (lib.attrValues redistsForPlatform)
|
||||
);
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user