Skip to content

Commit

Permalink
stdenv: add minimal flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Joseph committed Jan 8, 2023
1 parent 8d0d8e7 commit 77c2173
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions pkgs/stdenv/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=1830472
, rebootstrap ? localSystem.isAarch64

, minimal ? false

, bootstrapFiles ?
let table = {
glibc = {
Expand Down Expand Up @@ -198,7 +200,19 @@ in

# when rebootstrapping, we first prepend a copy of the stdenv stages
# that use the fetched bootstrapFiles:
lib.optionals rebootstrap (import ./. (args // { rebootstrap = false; })) ++
lib.optionals rebootstrap (import ./. (args // {
rebootstrap = false;
minimal = true;
overlays = overlays ++ [ (final: prev: {
gettext = null;
help2man = null;
texinfo = null;
python3Minimal = null;
python3 = null;
libxcrypt = null;
coreutils = prev.coreutilsMinimal;
}) ];
})) ++

[
(prevStage: {
Expand All @@ -218,6 +232,7 @@ lib.optionals rebootstrap (import ./. (args // { rebootstrap = false; })) ++
busyboxMinimal = prevStage.stdenv.bootstrapFiles.busybox;
# don't rebuild a custom compiler
bootGCC = prevStage.gcc.cc;
nukeReferences = prevStage.nukeReferences.override { perl = prevStage.stdenv.bootstrapTools; };
}).bootstrapFiles else bootstrapFiles);
})

Expand Down Expand Up @@ -267,6 +282,8 @@ lib.optionals rebootstrap (import ./. (args // { rebootstrap = false; })) ++
};
coreutils = bootstrapTools;
gnugrep = bootstrapTools;
} // lib.optionalAttrs minimal {
nukeReferences = prevStage.nukeReferences.override { perl = prevStage.bootstrapTools; };
};
})

Expand Down Expand Up @@ -303,7 +320,7 @@ lib.optionals rebootstrap (import ./. (args // { rebootstrap = false; })) ++
# This is not an issue for the final stdenv, because this perl
# won't be included in the final stdenv and won't be exported to
# top-level pkgs as an override either.
perl = super.perl.override { enableThreading = false; enableCrypt = false; };
perl = if minimal then prevStage.bootstrapTools else super.perl.override { enableThreading = false; enableCrypt = false; };
};
})

Expand Down Expand Up @@ -568,7 +585,12 @@ lib.optionals rebootstrap (import ./. (args // { rebootstrap = false; })) ++
inherit (self) stdenv runCommandLocal patchelf libunistring;
};

} // lib.optionalAttrs (!minimal) {
gnumake = super.gnumake.override { inBootstrap = false; };
} // lib.optionalAttrs minimal {
fetchurl = prevStage.stdenv.fetchurlBoot;
cpio = prevStage.bootstrapTools;
nukeReferences = prevStage.nukeReferences.override { perl = prevStage.bootstrapTools; };
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
# Need to get rid of these when cross-compiling.
inherit (prevStage) binutils binutils-unwrapped;
Expand Down

0 comments on commit 77c2173

Please sign in to comment.