From 765529dfff5cb04cd8ebf9275c9bccc9473fcbb5 Mon Sep 17 00:00:00 2001 From: Connor Baker Date: Thu, 15 May 2025 21:00:40 +0000 Subject: [PATCH] cudaPackages.fixups -> pkgs.cudaFixups --- .../cuda-modules/fixups/default.nix | 5 +++-- .../cuda-modules/generic-builders/manifest.nix | 4 ++-- pkgs/top-level/all-packages.nix | 2 ++ pkgs/top-level/cuda-packages.nix | 18 +++++------------- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/pkgs/development/cuda-modules/fixups/default.nix b/pkgs/development/cuda-modules/fixups/default.nix index 9166e413bb71..a5ec4a90e817 100644 --- a/pkgs/development/cuda-modules/fixups/default.nix +++ b/pkgs/development/cuda-modules/fixups/default.nix @@ -1,5 +1,6 @@ -{ lib }: - +let + lib = import ../../../../lib; +in lib.concatMapAttrs ( fileName: _type: let diff --git a/pkgs/development/cuda-modules/generic-builders/manifest.nix b/pkgs/development/cuda-modules/generic-builders/manifest.nix index f4eecc29f4dc..712db3bd5b99 100644 --- a/pkgs/development/cuda-modules/generic-builders/manifest.nix +++ b/pkgs/development/cuda-modules/generic-builders/manifest.nix @@ -5,9 +5,9 @@ autoPatchelfHook, backendStdenv, callPackage, + cudaFixups, cudaLib, fetchurl, - fixups, lib, markForCudatoolkitRootHook, flags, @@ -45,7 +45,7 @@ let # Last step before returning control to `callPackage` (adds the `.override` method) # we'll apply (`overrideAttrs`) necessary package-specific "fixup" functions. # Order is significant. - maybeFixup = fixups.${pname} or null; + maybeFixup = cudaFixups.${pname} or null; fixup = if maybeFixup != null then callPackage maybeFixup { } else { }; # Get the redist systems for which package provides distributables. diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 59d64e99c884..dafb9f56fa5d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2721,6 +2721,8 @@ with pkgs; cudaLib = import ../development/cuda-modules/lib; + cudaFixups = import ../development/cuda-modules/fixups; + cudaPackages_11_0 = callPackage ./cuda-packages.nix { cudaMajorMinorVersion = "11.0"; }; cudaPackages_11_1 = callPackage ./cuda-packages.nix { cudaMajorMinorVersion = "11.1"; }; cudaPackages_11_2 = callPackage ./cuda-packages.nix { cudaMajorMinorVersion = "11.2"; }; diff --git a/pkgs/top-level/cuda-packages.nix b/pkgs/top-level/cuda-packages.nix index 60bc5c0dd953..5870d383291e 100644 --- a/pkgs/top-level/cuda-packages.nix +++ b/pkgs/top-level/cuda-packages.nix @@ -26,7 +26,6 @@ cudaMajorMinorVersion, lib, newScope, - pkgs, stdenv, }: let @@ -39,9 +38,6 @@ let versions ; - # MUST be defined outside fix-point (cf. "NAMESET STRICTNESS" above) - fixups = import ../development/cuda-modules/fixups { inherit lib; }; - # Since Jetson capabilities are never built by default, we can check if any of them were requested # through final.config.cudaCapabilities and use that to determine if we should change some manifest versions. # Copied from backendStdenv. @@ -54,19 +50,15 @@ let passthruFunction = final: { # NOTE: - # It is important that cudaLib (and fixups, which will be addressed later) are not part of the package set - # fixed-point. - # As described by @SomeoneSerge: + # It is important that cudaLib and cudaFixups are not part of the package set fixed-point. As described by + # @SomeoneSerge: # > The layering should be: configuration -> (identifies/is part of) cudaPackages -> (is built using) cudaLib. # > No arrows should point in the reverse directions. # That is to say that cudaLib should only know about package sets and configurations, because it implements # functionality for interpreting configurations, resolving them against data, and constructing package sets. - inherit - cudaMajorMinorVersion - fixups - lib - pkgs - ; + # This decision is driven both by a separation of concerns and by "NAMESET STRICTNESS" (see above). + + inherit cudaMajorMinorVersion; cudaNamePrefix = "cuda${cudaMajorMinorVersion}";