lol

cudaPackages: multiplex builder provides broken attributes rather than no attributes

Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>

+32 -14
+1 -2
pkgs/development/cuda-modules/cudnn/shims.nix
··· 1 1 # Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix 2 2 { 3 - lib, 4 3 package, 5 4 # redistArch :: String 6 5 # String is "unsupported" if the given architecture is unsupported. 7 6 redistArch, 8 7 }: 9 8 { 10 - featureRelease = lib.optionalAttrs (redistArch != "unsupported") { 9 + featureRelease = { 11 10 inherit (package) minCudaVersion maxCudaVersion; 12 11 ${redistArch}.outputs = { 13 12 lib = true;
+30 -10
pkgs/development/cuda-modules/generic-builders/multiplex.nix
··· 52 52 lib.versionAtLeast cudaMajorMinorVersion package.minCudaVersion 53 53 && lib.versionAtLeast package.maxCudaVersion cudaMajorMinorVersion; 54 54 55 - # Releases for our platform and CUDA version. 55 + # Releases for our CUDA version. 56 + # Collapses the releases into a single list of packages, filtering out packages for unsupported CUDA versions and 57 + # augmenting those supporting the current CUDA version with the redistArch to which the package belongs. 56 58 # See ../modules/${pname}/releases/releases.nix 57 - # allPackages :: List Package 58 - allPackages = lib.filter satisfiesCudaVersion ( 59 - evaluatedModules.config.${pname}.releases.${redistArch} or [ ] 60 - ); 59 + # allPackages :: List (Package + { redistArch: String }) 60 + allPackages = 61 + let 62 + redistArchs = lib.attrNames evaluatedModules.config.${pname}.releases; 63 + in 64 + lib.concatMap ( 65 + redistArch: 66 + let 67 + packages = evaluatedModules.config.${pname}.releases.${redistArch}; 68 + in 69 + lib.concatMap ( 70 + package: lib.optionals (satisfiesCudaVersion package) [ ({ inherit redistArch; } // package) ] 71 + ) packages 72 + ) redistArchs; 73 + 74 + packageOlder = p1: p2: lib.versionOlder p1.version p2.version; 75 + packageSupportedPlatform = p: p.redistArch == redistArch; 61 76 62 77 # Compute versioned attribute name to be used in this package set 63 78 # Patch version changes should not break the build, so we only use major and minor ··· 77 92 newestPackages 78 93 // { 79 94 ${majorMinorVersion} = 80 - # Only keep the existing package if it is newer than the one we are considering. 81 - if existingPackage != null && lib.versionOlder package.version existingPackage.version then 95 + # Only keep the existing package if it is newer than the one we are considering or it is supported on the 96 + # current platform and the one we are considering is not. 97 + if 98 + existingPackage != null 99 + && ( 100 + packageOlder package existingPackage 101 + || (!packageSupportedPlatform package && packageSupportedPlatform existingPackage) 102 + ) 103 + then 82 104 existingPackage 83 105 else 84 106 package; ··· 87 109 in 88 110 # Sort the packages by version so the newest is first. 89 111 # NOTE: builtins.sort requires a strict weak ordering, so we must use versionOlder rather than versionAtLeast. 90 - lib.sort (p1: p2: lib.versionOlder p2.version p1.version) ( 91 - lib.attrValues newestForEachMajorMinorVersion 92 - ); 112 + lib.sort (lib.flip packageOlder) (lib.attrValues newestForEachMajorMinorVersion); 93 113 94 114 extension = 95 115 final: _:
+1 -2
pkgs/development/cuda-modules/tensorrt/shims.nix
··· 1 1 # Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix 2 2 { 3 - lib, 4 3 package, 5 4 # redistArch :: String 6 5 # String is `"unsupported"` if the given architecture is unsupported. 7 6 redistArch, 8 7 }: 9 8 { 10 - featureRelease = lib.optionalAttrs (redistArch != "unsupported") { 9 + featureRelease = { 11 10 inherit (package) cudnnVersion minCudaVersion maxCudaVersion; 12 11 ${redistArch}.outputs = { 13 12 bin = true;