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 lib.optionalAttrs allowCustomOverrides 117 ((config.packageOverrides or (super: {})) super); 118 119 - # The complete chain of package set builders, applied from top to bottom 120 toFix = lib.foldl' (lib.flip lib.extends) (self: {}) ([ 121 stdenvBootstappingAndPlatforms 122 platformCompat ··· 125 splice 126 allPackages 127 aliases 128 - stdenvOverrides 129 configOverrides 130 - ] ++ overlays); 131 132 in 133 # Return the complete set of packages.
··· 116 lib.optionalAttrs allowCustomOverrides 117 ((config.packageOverrides or (super: {})) super); 118 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. 122 toFix = lib.foldl' (lib.flip lib.extends) (self: {}) ([ 123 stdenvBootstappingAndPlatforms 124 platformCompat ··· 127 splice 128 allPackages 129 aliases 130 configOverrides 131 + ] ++ overlays ++ [ 132 + stdenvOverrides ]); 133 134 in 135 # Return the complete set of packages.