···5959 # - Releases: ../modules/${pname}/releases/releases.nix
6060 # - Package: ../modules/${pname}/releases/package.nix
61616262+ # FIXME: do this at the module system level
6363+ propagatePlatforms = lib.mapAttrs (platform: subset: map (r: r // { inherit platform; }) subset);
6464+6265 # All releases across all platforms
6366 # See ../modules/${pname}/releases/releases.nix
6464- allReleases = evaluatedModules.config.${pname}.releases;
6767+ releaseSets = propagatePlatforms evaluatedModules.config.${pname}.releases;
65686669 # Compute versioned attribute name to be used in this package set
6770 # Patch version changes should not break the build, so we only use major and minor
···7275 # isSupported :: Package -> Bool
7376 isSupported =
7477 package:
7575- strings.versionAtLeast cudaVersion package.minCudaVersion
7878+ !(strings.hasPrefix "unsupported" package.platform)
7979+ && strings.versionAtLeast cudaVersion package.minCudaVersion
7680 && strings.versionAtLeast package.maxCudaVersion cudaVersion;
77817882 # Get all of the packages for our given platform.
7983 redistArch = flags.getRedistArch hostPlatform.system;
80848585+ allReleases = builtins.concatMap (xs: xs) (builtins.attrValues releaseSets);
8686+8187 # All the supported packages we can build for our platform.
8282- # supportedPackages :: List (AttrSet Packages)
8383- supportedPackages = builtins.filter isSupported (allReleases.${redistArch} or []);
8888+ # perSystemReleases :: List Package
8989+ perSystemReleases = releaseSets.${redistArch} or [ ];
84908585- # newestToOldestSupportedPackage :: List (AttrSet Packages)
8686- newestToOldestSupportedPackage = lists.reverseList supportedPackages;
8787-8888- nameOfNewest = computeName (builtins.head newestToOldestSupportedPackage);
9191+ preferable =
9292+ p1: p2: (isSupported p2 -> isSupported p1) && (strings.versionAtLeast p1.version p2.version);
9393+ newest = builtins.head (builtins.sort preferable allReleases);
89949095 # A function which takes the `final` overlay and the `package` being built and returns
9196 # a function to be consumed via `overrideAttrs`.
···120125 attrsets.nameValuePair name fixedDrv;
121126122127 # versionedDerivations :: AttrSet Derivation
123123- versionedDerivations = builtins.listToAttrs (lists.map buildPackage newestToOldestSupportedPackage);
128128+ versionedDerivations = builtins.listToAttrs (lists.map buildPackage perSystemReleases);
124129125125- defaultDerivation = attrsets.optionalAttrs (versionedDerivations != {}) {
126126- ${pname} = versionedDerivations.${nameOfNewest};
127127- };
130130+ defaultDerivation = { ${pname} = (buildPackage newest).value; };
128131 in
129132 versionedDerivations // defaultDerivation;
130133in
+11-10
pkgs/development/cuda-modules/tensorrt/fixup.nix
···1616 strings
1717 versions
1818 ;
1919+ targetArch =
2020+ if hostPlatform.isx86_64 then
2121+ "x86_64-linux-gnu"
2222+ else if hostPlatform.isAarch64 then
2323+ "aarch64-linux-gnu"
2424+ else
2525+ "unsupported";
1926in
2027finalAttrs: prevAttrs: {
2128 # Useful for inspecting why something went wrong.
···5865 # We need to look inside the extracted output to get the files we need.
5966 sourceRoot = "TensorRT-${finalAttrs.version}";
60676161- buildInputs = prevAttrs.buildInputs ++ [finalAttrs.passthru.cudnn.lib];
6868+ buildInputs = prevAttrs.buildInputs ++ [ finalAttrs.passthru.cudnn.lib ];
62696370 preInstall =
6464- let
6565- targetArch =
6666- if hostPlatform.isx86_64 then
6767- "x86_64-linux-gnu"
6868- else if hostPlatform.isAarch64 then
6969- "aarch64-linux-gnu"
7070- else
7171- throw "Unsupported architecture";
7272- in
7371 (prevAttrs.preInstall or "")
7472 + ''
7573 # Replace symlinks to bin and lib with the actual directories from targets.
···107105 };
108106109107 meta = prevAttrs.meta // {
108108+ badPlatforms =
109109+ prevAttrs.meta.badPlatforms or [ ]
110110+ ++ lib.optionals (targetArch == "unsupported") [ hostPlatform.system ];
110111 homepage = "https://developer.nvidia.com/tensorrt";
111112 maintainers = prevAttrs.meta.maintainers ++ [maintainers.aidalgol];
112113 };