From 125de9a4c31aa3595aa5e5b1676bd69c9b0f14a3 Mon Sep 17 00:00:00 2001 From: Aliaksandr Date: Sat, 6 Jun 2026 05:44:11 +0300 Subject: [PATCH 1/2] stdenv: do not pass crossOverlays redundantly crossOverlays only needed for stageCross, so lets pass them only there --- pkgs/stdenv/custom/default.nix | 1 - pkgs/stdenv/darwin/default.nix | 1 - pkgs/stdenv/default.nix | 25 +++++++++++++++++-------- pkgs/stdenv/freebsd/default.nix | 1 - pkgs/stdenv/linux/default.nix | 2 -- pkgs/stdenv/native/default.nix | 1 - pkgs/stdenv/nix/default.nix | 3 +-- pkgs/top-level/impure.nix | 2 -- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkgs/stdenv/custom/default.nix b/pkgs/stdenv/custom/default.nix index 4520f0c9905a..b6fefa7c912e 100644 --- a/pkgs/stdenv/custom/default.nix +++ b/pkgs/stdenv/custom/default.nix @@ -4,7 +4,6 @@ crossSystem, config, overlays, - crossOverlays ? [ ], }: assert crossSystem == localSystem; diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 48c2db483e4a..d7e0dbf2c6ee 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -13,7 +13,6 @@ crossSystem, config, overlays, - crossOverlays ? [ ], # Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools bootstrapFiles ? (config.replaceBootstrapFiles or lib.id) ( if localSystem.isAarch64 then diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 3cbe274a2f0e..3e8a062ac6c0 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -13,31 +13,40 @@ config, overlays, crossOverlays ? [ ], -}@args: +}: let + commonArgs = { + inherit + lib + localSystem + crossSystem + config + overlays + ; + }; # The native (i.e., impure) build environment. This one uses the # tools installed on the system outside of the Nix environment, # i.e., the stuff in /bin, /usr/bin, etc. This environment should # be used with care, since many Nix packages will not build properly # with it (e.g., because they require GNU Make). - stagesNative = import ./native args; + stagesNative = import ./native commonArgs; # The Nix build environment. - stagesNix = import ./nix (args // { bootStages = stagesNative; }); + stagesNix = import ./nix (commonArgs // { bootStages = stagesNative; }); - stagesFreeBSD = import ./freebsd args; + stagesFreeBSD = import ./freebsd commonArgs; # On Linux systems, the standard build environment consists of Nix-built # instances glibc and the `standard' Unix tools, i.e., the Posix utilities, # the GNU C compiler, and so on. - stagesLinux = import ./linux args; + stagesLinux = import ./linux commonArgs; - stagesDarwin = import ./darwin args; + stagesDarwin = import ./darwin commonArgs; - stagesCross = import ./cross args; + stagesCross = import ./cross (commonArgs // { inherit crossOverlays; }); - stagesCustom = import ./custom args; + stagesCustom = import ./custom commonArgs; in # Select the appropriate stages for the platform `system'. diff --git a/pkgs/stdenv/freebsd/default.nix b/pkgs/stdenv/freebsd/default.nix index 7ede014f80f1..61c386b8437b 100644 --- a/pkgs/stdenv/freebsd/default.nix +++ b/pkgs/stdenv/freebsd/default.nix @@ -6,7 +6,6 @@ crossSystem, config, overlays, - crossOverlays ? [ ], bootstrapFiles ? let table = { diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index feb7f90a147f..77fb996d376b 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -59,8 +59,6 @@ crossSystem, config, overlays, - crossOverlays ? [ ], - bootstrapFiles ? let table = { diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix index 697e593e205a..690107af303f 100644 --- a/pkgs/stdenv/native/default.nix +++ b/pkgs/stdenv/native/default.nix @@ -4,7 +4,6 @@ crossSystem, config, overlays, - crossOverlays ? [ ], }: assert crossSystem == localSystem; diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix index 84998fa52581..f85971479bee 100644 --- a/pkgs/stdenv/nix/default.nix +++ b/pkgs/stdenv/nix/default.nix @@ -1,11 +1,10 @@ { lib, - crossSystem, localSystem, + crossSystem, config, overlays, bootStages, - ... }: assert crossSystem == localSystem; diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix index 851ab4282902..b1371e5fef8e 100644 --- a/pkgs/top-level/impure.nix +++ b/pkgs/top-level/impure.nix @@ -44,8 +44,6 @@ in # fix-point made by Nixpkgs. overlays ? import ./impure-overlays.nix, - crossOverlays ? [ ], - ... }@args: From b9e52062740278903f9db96940a8a6803deaa4b2 Mon Sep 17 00:00:00 2001 From: Aliaksandr Date: Sat, 6 Jun 2026 06:05:24 +0300 Subject: [PATCH 2/2] stdenv: drop redundant crossOverlays defaults The only callers are pkgs/top-level/default.nix and pkgs/stdenv/cross/default.nix always pass crossOverlays. Make the argument required to keep the internal interface explicit. --- pkgs/stdenv/cross/default.nix | 2 +- pkgs/stdenv/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index b194c780a319..f2adc91e2bb1 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -4,7 +4,7 @@ crossSystem, config, overlays, - crossOverlays ? [ ], + crossOverlays, }: let diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 3e8a062ac6c0..9e573477f290 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -12,7 +12,7 @@ crossSystem, config, overlays, - crossOverlays ? [ ], + crossOverlays, }: let