From 2dd1349006abecf79eb0c53473191d48207ff34d Mon Sep 17 00:00:00 2001 From: Aliaksandr Date: Sun, 19 Jul 2026 00:11:51 +0300 Subject: [PATCH] stdenv: stop passing crossSystem to local stages The dispatcher now constructs local bootstrap stages directly, so their target is represented entirely by localSystem. Remove the redundant crossSystem arguments and equality assertions from each local stage implementation. Assisted-by: codex with gpt-5.6-sol-high --- pkgs/stdenv/darwin/default.nix | 3 --- pkgs/stdenv/default.nix | 26 +++++++++++++------------- pkgs/stdenv/freebsd/default.nix | 2 -- pkgs/stdenv/linux/default.nix | 3 --- pkgs/stdenv/native/default.nix | 3 --- pkgs/stdenv/nix/default.nix | 2 -- 6 files changed, 13 insertions(+), 26 deletions(-) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index b19cdcc54de2..e87ceb8660aa 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -10,7 +10,6 @@ { lib, localSystem, - crossSystem, config, overlays, # Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools @@ -22,8 +21,6 @@ ), }: -assert crossSystem == localSystem; - let inherit (localSystem) system; genericStdenv = import ../generic { defaultConfig = config; }; diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 8e265d6d3e6b..56ae4538ea6a 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -16,24 +16,14 @@ }: let - commonArgs = { - inherit - lib - localSystem - crossSystem - config - overlays - ; - }; - useCrossStdenv = crossSystem != localSystem || crossOverlays != [ ]; useCustomStdenv = !useCrossStdenv && (config.replaceStdenv or null) != null; # Cross and custom stdenvs extend the local bootstrap stages. Keep # replaceStdenv out of those stages so it is applied only by the appended # custom stage; cross compilation uses replaceCrossStdenv instead. - bootArgs = commonArgs // { - crossSystem = if useCrossStdenv then localSystem else crossSystem; + bootArgs = { + inherit lib localSystem overlays; config = if useCrossStdenv || useCustomStdenv then removeAttrs config [ "replaceStdenv" ] else config; }; @@ -69,7 +59,17 @@ let } .${localSystem.system} or stagesNative; - stagesCross = import ./cross (commonArgs // { inherit crossOverlays bootStages; }); + stagesCross = import ./cross { + inherit + lib + localSystem + crossSystem + config + overlays + crossOverlays + bootStages + ; + }; replaceStdenvStage = vanillaPackages: { inherit config overlays; diff --git a/pkgs/stdenv/freebsd/default.nix b/pkgs/stdenv/freebsd/default.nix index 61c386b8437b..0192238b7ae8 100644 --- a/pkgs/stdenv/freebsd/default.nix +++ b/pkgs/stdenv/freebsd/default.nix @@ -3,7 +3,6 @@ { lib, localSystem, - crossSystem, config, overlays, bootstrapFiles ? @@ -18,7 +17,6 @@ files, }: -assert crossSystem == localSystem; let genericStdenv = import ../generic { defaultConfig = config; }; diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index c9b64c3086e8..3948fc5f71ca 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -56,7 +56,6 @@ { lib, localSystem, - crossSystem, config, overlays, bootstrapFiles ? @@ -116,8 +115,6 @@ (config.replaceBootstrapFiles or lib.id) files, }: -assert crossSystem == localSystem; - let genericStdenv = import ../generic { defaultConfig = config; }; diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix index 690107af303f..1def78bcd6a9 100644 --- a/pkgs/stdenv/native/default.nix +++ b/pkgs/stdenv/native/default.nix @@ -1,13 +1,10 @@ { lib, localSystem, - crossSystem, config, overlays, }: -assert crossSystem == localSystem; - let genericStdenv = import ../generic { defaultConfig = config; }; diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix index f85971479bee..a7de0d82ee56 100644 --- a/pkgs/stdenv/nix/default.nix +++ b/pkgs/stdenv/nix/default.nix @@ -1,13 +1,11 @@ { lib, localSystem, - crossSystem, config, overlays, bootStages, }: -assert crossSystem == localSystem; let genericStdenv = import ../generic { defaultConfig = config; }; in