mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
Merge pull request #282185 from SomeoneSerge/fix/cu-multiplex
cudaPackages: fix version solving (again) Unbreaks tensorflowWithCuda and cudaPackagesGoogle.cudnn_8_6
This commit is contained in:
commit
0689dd2c53
@ -47,6 +47,8 @@ let
|
||||
# The redistArch is the name of the architecture for which the redistributable is built.
|
||||
# It is `"unsupported"` if the redistributable is not supported on the target platform.
|
||||
redistArch = flags.getRedistArch hostPlatform.system;
|
||||
|
||||
sourceMatchesHost = flags.getNixSystem redistArch == stdenv.hostPlatform.system;
|
||||
in
|
||||
backendStdenv.mkDerivation (
|
||||
finalAttrs: {
|
||||
@ -136,7 +138,9 @@ backendStdenv.mkDerivation (
|
||||
# badPlatformsConditions :: AttrSet Bool
|
||||
# Sets `meta.badPlatforms = meta.platforms` if any of the conditions are true.
|
||||
# Example: Broken on a specific architecture when some condition is met (like targeting Jetson).
|
||||
badPlatformsConditions = { };
|
||||
badPlatformsConditions = {
|
||||
"No source" = !sourceMatchesHost;
|
||||
};
|
||||
|
||||
# src :: Optional Derivation
|
||||
src = trivial.pipe redistArch [
|
||||
|
@ -52,7 +52,7 @@ let
|
||||
# - Package: ../modules/${pname}/releases/package.nix
|
||||
|
||||
# FIXME: do this at the module system level
|
||||
propagatePlatforms = lib.mapAttrs (platform: subset: map (r: r // { inherit platform; }) subset);
|
||||
propagatePlatforms = lib.mapAttrs (redistArch: packages: map (p: { inherit redistArch; } // p) packages);
|
||||
|
||||
# All releases across all platforms
|
||||
# See ../modules/${pname}/releases/releases.nix
|
||||
@ -67,8 +67,7 @@ let
|
||||
# isSupported :: Package -> Bool
|
||||
isSupported =
|
||||
package:
|
||||
# The `platform` attribute of the package is NVIDIA's name for a redistributable architecture.
|
||||
redistArch == package.platform
|
||||
redistArch == package.redistArch
|
||||
&& strings.versionAtLeast cudaVersion package.minCudaVersion
|
||||
&& strings.versionAtLeast package.maxCudaVersion cudaVersion;
|
||||
|
||||
@ -77,14 +76,22 @@ let
|
||||
# Value is `"unsupported"` if the platform is not supported.
|
||||
redistArch = flags.getRedistArch hostPlatform.system;
|
||||
|
||||
allReleases = lists.flatten (builtins.attrValues releaseSets);
|
||||
preferable =
|
||||
p1: p2: (isSupported p2 -> isSupported p1) && (strings.versionAtLeast p1.version p2.version);
|
||||
|
||||
# All the supported packages we can build for our platform.
|
||||
# perSystemReleases :: List Package
|
||||
perSystemReleases = releaseSets.${redistArch} or [ ];
|
||||
allReleases = lib.pipe releaseSets
|
||||
[
|
||||
(builtins.attrValues)
|
||||
(lists.flatten)
|
||||
(builtins.groupBy (p: lib.versions.majorMinor p.version))
|
||||
(builtins.mapAttrs (_: builtins.sort preferable))
|
||||
(builtins.mapAttrs (_: lib.take 1))
|
||||
(builtins.attrValues)
|
||||
(builtins.concatMap lib.trivial.id)
|
||||
];
|
||||
|
||||
preferable =
|
||||
p1: p2: (isSupported p2 -> isSupported p1) && (strings.versionAtLeast p1.version p2.version);
|
||||
newest = builtins.head (builtins.sort preferable allReleases);
|
||||
|
||||
# A function which takes the `final` overlay and the `package` being built and returns
|
||||
@ -108,7 +115,7 @@ let
|
||||
buildPackage =
|
||||
package:
|
||||
let
|
||||
shims = final.callPackage shimsFn {inherit package redistArch;};
|
||||
shims = final.callPackage shimsFn {inherit package; inherit (package) redistArch; };
|
||||
name = computeName package;
|
||||
drv = final.callPackage ./manifest.nix {
|
||||
inherit pname;
|
||||
@ -120,7 +127,7 @@ let
|
||||
attrsets.nameValuePair name fixedDrv;
|
||||
|
||||
# versionedDerivations :: AttrSet Derivation
|
||||
versionedDerivations = builtins.listToAttrs (lists.map buildPackage perSystemReleases);
|
||||
versionedDerivations = builtins.listToAttrs (lists.map buildPackage allReleases);
|
||||
|
||||
defaultDerivation = { ${pname} = (buildPackage newest).value; };
|
||||
in
|
||||
|
Loading…
Reference in New Issue
Block a user