···5252 lib.versionAtLeast cudaMajorMinorVersion package.minCudaVersion
5353 && lib.versionAtLeast package.maxCudaVersion cudaMajorMinorVersion;
54545555- # Releases for our platform and CUDA version.
5555+ # Releases for our CUDA version.
5656+ # Collapses the releases into a single list of packages, filtering out packages for unsupported CUDA versions and
5757+ # augmenting those supporting the current CUDA version with the redistArch to which the package belongs.
5658 # See ../modules/${pname}/releases/releases.nix
5757- # allPackages :: List Package
5858- allPackages = lib.filter satisfiesCudaVersion (
5959- evaluatedModules.config.${pname}.releases.${redistArch} or [ ]
6060- );
5959+ # allPackages :: List (Package + { redistArch: String })
6060+ allPackages =
6161+ let
6262+ redistArchs = lib.attrNames evaluatedModules.config.${pname}.releases;
6363+ in
6464+ lib.concatMap (
6565+ redistArch:
6666+ let
6767+ packages = evaluatedModules.config.${pname}.releases.${redistArch};
6868+ in
6969+ lib.concatMap (
7070+ package: lib.optionals (satisfiesCudaVersion package) [ ({ inherit redistArch; } // package) ]
7171+ ) packages
7272+ ) redistArchs;
7373+7474+ packageOlder = p1: p2: lib.versionOlder p1.version p2.version;
7575+ packageSupportedPlatform = p: p.redistArch == redistArch;
61766277 # Compute versioned attribute name to be used in this package set
6378 # Patch version changes should not break the build, so we only use major and minor
···7792 newestPackages
7893 // {
7994 ${majorMinorVersion} =
8080- # Only keep the existing package if it is newer than the one we are considering.
8181- if existingPackage != null && lib.versionOlder package.version existingPackage.version then
9595+ # Only keep the existing package if it is newer than the one we are considering or it is supported on the
9696+ # current platform and the one we are considering is not.
9797+ if
9898+ existingPackage != null
9999+ && (
100100+ packageOlder package existingPackage
101101+ || (!packageSupportedPlatform package && packageSupportedPlatform existingPackage)
102102+ )
103103+ then
82104 existingPackage
83105 else
84106 package;
···87109 in
88110 # Sort the packages by version so the newest is first.
89111 # NOTE: builtins.sort requires a strict weak ordering, so we must use versionOlder rather than versionAtLeast.
9090- lib.sort (p1: p2: lib.versionOlder p2.version p1.version) (
9191- lib.attrValues newestForEachMajorMinorVersion
9292- );
112112+ lib.sort (lib.flip packageOlder) (lib.attrValues newestForEachMajorMinorVersion);
9311394114 extension =
95115 final: _:
+1-2
pkgs/development/cuda-modules/tensorrt/shims.nix
···11# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
22{
33- lib,
43 package,
54 # redistArch :: String
65 # String is `"unsupported"` if the given architecture is unsupported.
76 redistArch,
87}:
98{
1010- featureRelease = lib.optionalAttrs (redistArch != "unsupported") {
99+ featureRelease = {
1110 inherit (package) cudnnVersion minCudaVersion maxCudaVersion;
1211 ${redistArch}.outputs = {
1312 bin = true;