mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 12:45:27 +03:00
cudaPackages: multiplex builder always provides attributes (#406207)
This commit is contained in:
commit
1a120d440a
3 changed files with 27 additions and 15 deletions
|
@ -1,13 +1,12 @@
|
||||||
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
|
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
package,
|
package,
|
||||||
# redistArch :: String
|
# redistArch :: String
|
||||||
# String is "unsupported" if the given architecture is unsupported.
|
# String is "unsupported" if the given architecture is unsupported.
|
||||||
redistArch,
|
redistArch,
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
featureRelease = lib.optionalAttrs (redistArch != "unsupported") {
|
featureRelease = {
|
||||||
inherit (package) minCudaVersion maxCudaVersion;
|
inherit (package) minCudaVersion maxCudaVersion;
|
||||||
${redistArch}.outputs = {
|
${redistArch}.outputs = {
|
||||||
lib = true;
|
lib = true;
|
||||||
|
|
|
@ -52,12 +52,20 @@ let
|
||||||
lib.versionAtLeast cudaMajorMinorVersion package.minCudaVersion
|
lib.versionAtLeast cudaMajorMinorVersion package.minCudaVersion
|
||||||
&& lib.versionAtLeast package.maxCudaVersion cudaMajorMinorVersion;
|
&& lib.versionAtLeast package.maxCudaVersion cudaMajorMinorVersion;
|
||||||
|
|
||||||
# Releases for our platform and CUDA version.
|
# FIXME: do this at the module system level
|
||||||
# See ../modules/${pname}/releases/releases.nix
|
propagatePlatforms = lib.mapAttrs (redistArch: lib.map (p: { inherit redistArch; } // p));
|
||||||
# allPackages :: List Package
|
|
||||||
allPackages = lib.filter satisfiesCudaVersion (
|
# Releases for all platforms and all CUDA versions.
|
||||||
evaluatedModules.config.${pname}.releases.${redistArch} or [ ]
|
allReleases = propagatePlatforms evaluatedModules.config.${pname}.releases;
|
||||||
);
|
|
||||||
|
# Releases for all platforms and our CUDA version.
|
||||||
|
allReleases' = lib.mapAttrs (_: lib.filter satisfiesCudaVersion) allReleases;
|
||||||
|
|
||||||
|
# Packages for all platforms and our CUDA versions.
|
||||||
|
allPackages = lib.concatLists (lib.attrValues allReleases');
|
||||||
|
|
||||||
|
packageOlder = p1: p2: lib.versionOlder p1.version p2.version;
|
||||||
|
packageSupportedPlatform = p: p.redistArch == redistArch;
|
||||||
|
|
||||||
# Compute versioned attribute name to be used in this package set
|
# Compute versioned attribute name to be used in this package set
|
||||||
# Patch version changes should not break the build, so we only use major and minor
|
# Patch version changes should not break the build, so we only use major and minor
|
||||||
|
@ -77,8 +85,15 @@ let
|
||||||
newestPackages
|
newestPackages
|
||||||
// {
|
// {
|
||||||
${majorMinorVersion} =
|
${majorMinorVersion} =
|
||||||
# Only keep the existing package if it is newer than the one we are considering.
|
# Only keep the existing package if it is newer than the one we are considering or it is supported on the
|
||||||
if existingPackage != null && lib.versionOlder package.version existingPackage.version then
|
# current platform and the one we are considering is not.
|
||||||
|
if
|
||||||
|
existingPackage != null
|
||||||
|
&& (
|
||||||
|
packageOlder package existingPackage
|
||||||
|
|| (!packageSupportedPlatform package && packageSupportedPlatform existingPackage)
|
||||||
|
)
|
||||||
|
then
|
||||||
existingPackage
|
existingPackage
|
||||||
else
|
else
|
||||||
package;
|
package;
|
||||||
|
@ -87,9 +102,8 @@ let
|
||||||
in
|
in
|
||||||
# Sort the packages by version so the newest is first.
|
# Sort the packages by version so the newest is first.
|
||||||
# NOTE: builtins.sort requires a strict weak ordering, so we must use versionOlder rather than versionAtLeast.
|
# NOTE: builtins.sort requires a strict weak ordering, so we must use versionOlder rather than versionAtLeast.
|
||||||
lib.sort (p1: p2: lib.versionOlder p2.version p1.version) (
|
# See https://github.com/NixOS/nixpkgs/commit/9fd753ea84e5035b357a275324e7fd7ccfb1fc77.
|
||||||
lib.attrValues newestForEachMajorMinorVersion
|
lib.sort (lib.flip packageOlder) (lib.attrValues newestForEachMajorMinorVersion);
|
||||||
);
|
|
||||||
|
|
||||||
extension =
|
extension =
|
||||||
final: _:
|
final: _:
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
|
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
package,
|
package,
|
||||||
# redistArch :: String
|
# redistArch :: String
|
||||||
# String is `"unsupported"` if the given architecture is unsupported.
|
# String is `"unsupported"` if the given architecture is unsupported.
|
||||||
redistArch,
|
redistArch,
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
featureRelease = lib.optionalAttrs (redistArch != "unsupported") {
|
featureRelease = {
|
||||||
inherit (package) cudnnVersion minCudaVersion maxCudaVersion;
|
inherit (package) cudnnVersion minCudaVersion maxCudaVersion;
|
||||||
${redistArch}.outputs = {
|
${redistArch}.outputs = {
|
||||||
bin = true;
|
bin = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue