Merge pull request #282185 from SomeoneSerge/fix/cu-multiplex

cudaPackages: fix version solving (again)

Unbreaks tensorflowWithCuda and cudaPackagesGoogle.cudnn_8_6

authored by Someone and committed by GitHub 0689dd2c e7120ab3

+21 -10
+5 -1
pkgs/development/cuda-modules/generic-builders/manifest.nix
··· 47 # The redistArch is the name of the architecture for which the redistributable is built. 48 # It is `"unsupported"` if the redistributable is not supported on the target platform. 49 redistArch = flags.getRedistArch hostPlatform.system; 50 in 51 backendStdenv.mkDerivation ( 52 finalAttrs: { ··· 136 # badPlatformsConditions :: AttrSet Bool 137 # Sets `meta.badPlatforms = meta.platforms` if any of the conditions are true. 138 # Example: Broken on a specific architecture when some condition is met (like targeting Jetson). 139 - badPlatformsConditions = { }; 140 141 # src :: Optional Derivation 142 src = trivial.pipe redistArch [
··· 47 # The redistArch is the name of the architecture for which the redistributable is built. 48 # It is `"unsupported"` if the redistributable is not supported on the target platform. 49 redistArch = flags.getRedistArch hostPlatform.system; 50 + 51 + sourceMatchesHost = flags.getNixSystem redistArch == stdenv.hostPlatform.system; 52 in 53 backendStdenv.mkDerivation ( 54 finalAttrs: { ··· 138 # badPlatformsConditions :: AttrSet Bool 139 # Sets `meta.badPlatforms = meta.platforms` if any of the conditions are true. 140 # Example: Broken on a specific architecture when some condition is met (like targeting Jetson). 141 + badPlatformsConditions = { 142 + "No source" = !sourceMatchesHost; 143 + }; 144 145 # src :: Optional Derivation 146 src = trivial.pipe redistArch [
+16 -9
pkgs/development/cuda-modules/generic-builders/multiplex.nix
··· 52 # - Package: ../modules/${pname}/releases/package.nix 53 54 # FIXME: do this at the module system level 55 - propagatePlatforms = lib.mapAttrs (platform: subset: map (r: r // { inherit platform; }) subset); 56 57 # All releases across all platforms 58 # See ../modules/${pname}/releases/releases.nix ··· 67 # isSupported :: Package -> Bool 68 isSupported = 69 package: 70 - # The `platform` attribute of the package is NVIDIA's name for a redistributable architecture. 71 - redistArch == package.platform 72 && strings.versionAtLeast cudaVersion package.minCudaVersion 73 && strings.versionAtLeast package.maxCudaVersion cudaVersion; 74 ··· 77 # Value is `"unsupported"` if the platform is not supported. 78 redistArch = flags.getRedistArch hostPlatform.system; 79 80 - allReleases = lists.flatten (builtins.attrValues releaseSets); 81 82 # All the supported packages we can build for our platform. 83 # perSystemReleases :: List Package 84 - perSystemReleases = releaseSets.${redistArch} or [ ]; 85 86 - preferable = 87 - p1: p2: (isSupported p2 -> isSupported p1) && (strings.versionAtLeast p1.version p2.version); 88 newest = builtins.head (builtins.sort preferable allReleases); 89 90 # A function which takes the `final` overlay and the `package` being built and returns ··· 108 buildPackage = 109 package: 110 let 111 - shims = final.callPackage shimsFn {inherit package redistArch;}; 112 name = computeName package; 113 drv = final.callPackage ./manifest.nix { 114 inherit pname; ··· 120 attrsets.nameValuePair name fixedDrv; 121 122 # versionedDerivations :: AttrSet Derivation 123 - versionedDerivations = builtins.listToAttrs (lists.map buildPackage perSystemReleases); 124 125 defaultDerivation = { ${pname} = (buildPackage newest).value; }; 126 in
··· 52 # - Package: ../modules/${pname}/releases/package.nix 53 54 # FIXME: do this at the module system level 55 + propagatePlatforms = lib.mapAttrs (redistArch: packages: map (p: { inherit redistArch; } // p) packages); 56 57 # All releases across all platforms 58 # See ../modules/${pname}/releases/releases.nix ··· 67 # isSupported :: Package -> Bool 68 isSupported = 69 package: 70 + redistArch == package.redistArch 71 && strings.versionAtLeast cudaVersion package.minCudaVersion 72 && strings.versionAtLeast package.maxCudaVersion cudaVersion; 73 ··· 76 # Value is `"unsupported"` if the platform is not supported. 77 redistArch = flags.getRedistArch hostPlatform.system; 78 79 + preferable = 80 + p1: p2: (isSupported p2 -> isSupported p1) && (strings.versionAtLeast p1.version p2.version); 81 82 # All the supported packages we can build for our platform. 83 # perSystemReleases :: List Package 84 + allReleases = lib.pipe releaseSets 85 + [ 86 + (builtins.attrValues) 87 + (lists.flatten) 88 + (builtins.groupBy (p: lib.versions.majorMinor p.version)) 89 + (builtins.mapAttrs (_: builtins.sort preferable)) 90 + (builtins.mapAttrs (_: lib.take 1)) 91 + (builtins.attrValues) 92 + (builtins.concatMap lib.trivial.id) 93 + ]; 94 95 newest = builtins.head (builtins.sort preferable allReleases); 96 97 # A function which takes the `final` overlay and the `package` being built and returns ··· 115 buildPackage = 116 package: 117 let 118 + shims = final.callPackage shimsFn {inherit package; inherit (package) redistArch; }; 119 name = computeName package; 120 drv = final.callPackage ./manifest.nix { 121 inherit pname; ··· 127 attrsets.nameValuePair name fixedDrv; 128 129 # versionedDerivations :: AttrSet Derivation 130 + versionedDerivations = builtins.listToAttrs (lists.map buildPackage allReleases); 131 132 defaultDerivation = { ${pname} = (buildPackage newest).value; }; 133 in