From 493f1e3b8be80df5ecd1ee4566de63ca352af73f Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 31 Mar 2025 00:32:46 +0200 Subject: [PATCH 1/3] nixVersions.nix_2_26: Improve docs --- .../nix/vendor/2_26/packaging/components.nix | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix b/pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix index f65370e12490..6b26b225ff4f 100644 --- a/pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix +++ b/pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix @@ -240,6 +240,8 @@ in /** Apply an extension function (i.e. overlay-shaped) to all component derivations. + + Single argument: the extension function to apply (finalAttrs: prevAttrs: { ... }) */ overrideAllMesonComponents = f: @@ -253,7 +255,11 @@ in Provide an alternate source. This allows the expressions to be vendored without copying the sources, but it does make the build non-granular; all components will use a complete source. - Packaging expressions will be ignored. + Filesets in the packaging expressions will be ignored. + + Single argument: the source to use. + + See also `appendPatches` */ overrideSource = src: @@ -294,6 +300,10 @@ in This affects all components. Changes to the packaging expressions will be ignored. + + Single argument: list of patches to apply + + See also `overrideSource` */ appendPatches = patches: @@ -367,7 +377,7 @@ in nix-perl-bindings = callPackage ../src/perl/package.nix { }; nix-everything = callPackage ../packaging/everything.nix { } // { - # Note: no `passthru.overrideAllMesonComponents` + # Note: no `passthru.overrideAllMesonComponents` etc # This would propagate into `nix.overrideAttrs f`, but then discard # `f` when `.overrideAllMesonComponents` is used. # Both "methods" should be views on the same fixpoint overriding mechanism @@ -375,6 +385,8 @@ in # two-fixpoint solution. /** Apply an extension function (i.e. overlay-shaped) to all component derivations, and return the nix package. + + Single argument: the extension function to apply (finalAttrs: prevAttrs: { ... }) */ overrideAllMesonComponents = f: (scope.overrideAllMesonComponents f).nix-everything; @@ -383,6 +395,10 @@ in This affects all components. Changes to the packaging expressions will be ignored. + + Single argument: list of patches to apply + + See also `overrideSource` */ appendPatches = ps: (scope.appendPatches ps).nix-everything; @@ -390,7 +406,11 @@ in Provide an alternate source. This allows the expressions to be vendored without copying the sources, but it does make the build non-granular; all components will use a complete source. - Packaging expressions will be ignored. + Filesets in the packaging expressions will be ignored. + + Single argument: the source to use. + + See also `appendPatches` */ overrideSource = src: (scope.overrideSource src).nix-everything; From d74838df79a28007d34bc0c84beeecf78d864687 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 31 Mar 2025 00:33:57 +0200 Subject: [PATCH 2/3] nixVersions.nix_2_26: Add .overrideScope --- .../nix/vendor/2_26/packaging/components.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix b/pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix index 6b26b225ff4f..77cf9c9a5065 100644 --- a/pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix +++ b/pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix @@ -414,5 +414,17 @@ in */ overrideSource = src: (scope.overrideSource src).nix-everything; + /** + Override any internals of the Nix package set. + + Single argument: the extension function to apply to the package set (finalScope: prevScope: { ... }) + + Example: + ``` + overrideScope (finalScope: prevScope: { aws-sdk-cpp = null; }) + ``` + */ + overrideScope = f: (scope.overrideScope f).nix-everything; + }; } From bb984408d5c640d4b1eb9f5cc6cbfa500b96a798 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 31 Mar 2025 00:34:37 +0200 Subject: [PATCH 3/3] lib/tests/release.nix: Use nix.overrideScope for >=2.26 --- lib/tests/nix-for-tests.nix | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/tests/nix-for-tests.nix b/lib/tests/nix-for-tests.nix index cac9400d7b7d..96c01241773a 100644 --- a/lib/tests/nix-for-tests.nix +++ b/lib/tests/nix-for-tests.nix @@ -1,4 +1,5 @@ { + lib ? pkgs.lib, pkgs, }: @@ -13,20 +14,8 @@ builtins.mapAttrs ( attr: pkg: - if - # TODO descend in `nixComponents_*` and override `nix-store`. Also - # need to introduce the flag needed to do that with. - # - # This must be done before Nix 2.26 and beyond becomes the default. - !(builtins.elem attr [ - "nixComponents_2_26" - "nix_2_26" - "latest" - ]) - # There may-be non-package things, like functions, in there too - && builtins.isAttrs pkg - then - pkg.override { withAWS = false; } + if lib.versionAtLeast pkg.version "2.26" then + pkg.overrideScope (finalScope: prevScope: { aws-sdk-cpp = null; }) else - pkg + pkg.override { withAWS = false; } ) pkgs.nixVersions