about summary refs log tree commit diff
path: root/pkgs/development/cuda-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/cuda-modules')
-rw-r--r--pkgs/development/cuda-modules/backend-stdenv.nix36
-rw-r--r--pkgs/development/cuda-modules/cuda/overrides.nix2
-rw-r--r--pkgs/development/cuda-modules/generic-builders/manifest.nix6
-rw-r--r--pkgs/development/cuda-modules/generic-builders/multiplex.nix25
4 files changed, 26 insertions, 43 deletions
diff --git a/pkgs/development/cuda-modules/backend-stdenv.nix b/pkgs/development/cuda-modules/backend-stdenv.nix
index 7374c45b58d43..bcca7118b163b 100644
--- a/pkgs/development/cuda-modules/backend-stdenv.nix
+++ b/pkgs/development/cuda-modules/backend-stdenv.nix
@@ -13,40 +13,14 @@ let
   gccMajorVersion = nvccCompatibilities.${cudaVersion}.gccMaxMajorVersion;
   cudaStdenv = stdenvAdapters.useLibsFrom stdenv pkgs."gcc${gccMajorVersion}Stdenv";
   passthruExtra = {
-    nixpkgsCompatibleLibstdcxx = lib.warn "cudaPackages.backendStdenv.nixpkgsCompatibleLibstdcxx is misnamed, deprecated, and will be removed after 24.05" cudaStdenv.cc.cxxStdlib.package;
-    # cc already exposed
+    # cudaPackages.backendStdenv.nixpkgsCompatibleLibstdcxx has been removed,
+    # if you need it you're likely doing something wrong. There has been a
+    # warning here for a month or so. Now we can no longer return any
+    # meaningful value in its place and drop the attribute entirely.
   };
   assertCondition = true;
 in
 
-/*
-# We should use libstdc++ at least as new as nixpkgs' stdenv's one.
-assert let
-  cxxStdlibCuda = cudaStdenv.cc.cxxStdlib.package;
-  cxxStdlibNixpkgs = stdenv.cc.cxxStdlib.package;
-
-  # Expose the C++ standard library we're using. See the comments on "General
-  # libc++ support". This is also relevant when using older gcc than the
-  # stdenv's, as may be required e.g. by CUDAToolkit's nvcc.
-  cxxStdlib = libcxx:
-    let
-      givenLibcxx = libcxx != null && (libcxx.isLLVM or false);
-      givenGccForLibs = libcxx != null && !(libcxx.isLLVM or false) && (libcxx.isGNU or false);
-      libcxx_solib = "${lib.getLib libcxx}/lib";
-    in
-      if (!givenLibcxx) && givenGccForLibs then
-        { kind = "libstdc++"; package = libcxx; solib = libcxx_solib; }
-      else if givenLibcxx then
-        { kind = "libc++"; package = libcxx;  solib = libcxx_solib;}
-      else
-        # We're probably using the `libstdc++` that came with our `gcc`.
-        # TODO: this is maybe not always correct?
-        # TODO: what happens when `nativeTools = true`?
-        { kind = "libstdc++"; package = cc; solib = cc_solib; }
-  ;
-in
-((stdenv.cc.cxxStdlib.kind or null) == "libstdc++")
--> lib.versionAtLeast cxxStdlibCuda.version cxxStdlibNixpkgs.version;
-*/
+  /* TODO: Consider testing whether we in fact use the newer libstdc++ */
 
 lib.extendDerivation assertCondition passthruExtra cudaStdenv
diff --git a/pkgs/development/cuda-modules/cuda/overrides.nix b/pkgs/development/cuda-modules/cuda/overrides.nix
index 69ddab17bac31..f43d649afbbf3 100644
--- a/pkgs/development/cuda-modules/cuda/overrides.nix
+++ b/pkgs/development/cuda-modules/cuda/overrides.nix
@@ -112,7 +112,6 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
         useCcForLibs = true;
         gccForLibs = ccForLibs-wrapper.cc;
       };
-      cxxStdlibDir = ccForLibs-wrapper.cxxStdlib.solib or (throw "necessary to fix CI");
     in
     {
 
@@ -149,7 +148,6 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
 
           # Fix a compatible backend compiler
           PATH += ${lib.getBin cc}/bin:
-          LIBRARIES += "-L${cxxStdlibDir}/lib"
 
           # Expose the split-out nvvm
           LIBRARIES =+ -L''${!outputBin}/nvvm/lib
diff --git a/pkgs/development/cuda-modules/generic-builders/manifest.nix b/pkgs/development/cuda-modules/generic-builders/manifest.nix
index 38b80ff29f77f..5e837fa36b5e6 100644
--- a/pkgs/development/cuda-modules/generic-builders/manifest.nix
+++ b/pkgs/development/cuda-modules/generic-builders/manifest.nix
@@ -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 [
diff --git a/pkgs/development/cuda-modules/generic-builders/multiplex.nix b/pkgs/development/cuda-modules/generic-builders/multiplex.nix
index b8ac84bda9133..abe8ad242a3a3 100644
--- a/pkgs/development/cuda-modules/generic-builders/multiplex.nix
+++ b/pkgs/development/cuda-modules/generic-builders/multiplex.nix
@@ -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