top-level: Duplicate overlaying unless stdenvOverrides comes last

The stdenvOverrides overlay is used to bring packages forward during
bootstrapping via stdenv.overrides. These packages have already had
the overlays applied to them in the previous boostrapping stage. If
stdenvOverrides is not last in the overlays stack, all remaining
overlays will windup being applied again to these packages.

closes #34086

authored by Tyson Whitehead and committed by John Ericson fefa9ef7 afb87a66

+5 -3
+5 -3
pkgs/top-level/stage.nix
··· 116 116 lib.optionalAttrs allowCustomOverrides 117 117 ((config.packageOverrides or (super: {})) super); 118 118 119 - # The complete chain of package set builders, applied from top to bottom 119 + # The complete chain of package set builders, applied from top to bottom. 120 + # stdenvOverlays must be last as it brings package forward from the 121 + # previous bootstrapping phases which have already been overlayed. 120 122 toFix = lib.foldl' (lib.flip lib.extends) (self: {}) ([ 121 123 stdenvBootstappingAndPlatforms 122 124 platformCompat ··· 125 127 splice 126 128 allPackages 127 129 aliases 128 - stdenvOverrides 129 130 configOverrides 130 - ] ++ overlays); 131 + ] ++ overlays ++ [ 132 + stdenvOverrides ]); 131 133 132 134 in 133 135 # Return the complete set of packages.