stdenv: refactor to hook up minimal-bootstrap

This commit is contained in:
Aleksi Hannula
2026-01-26 21:45:18 +02:00
parent c0f2616f95
commit 5500570e9f
10 changed files with 614 additions and 532 deletions
@@ -28,406 +28,416 @@ lib.makeScope
)
)
(
self: with self; {
self:
with self;
(
{
supportedSystems = [
"i686-linux"
"x86_64-linux"
];
bash_2_05 = callPackage ./bash/2.nix { tinycc = tinycc-mes; };
bash_2_05 = callPackage ./bash/2.nix { tinycc = tinycc-mes; };
bash = callPackage ./bash {
bootBash = bash_2_05;
tinycc = tinycc-musl;
coreutils = coreutils-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
bash = callPackage ./bash {
bootBash = bash_2_05;
tinycc = tinycc-musl;
coreutils = coreutils-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
bash-static = callPackage ./bash/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
bash-static = callPackage ./bash/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
binutils = callPackage ./binutils {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
binutils = callPackage ./binutils {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
binutils-static = callPackage ./binutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
binutils-static = callPackage ./binutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
bison = callPackage ./bison {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
bison = callPackage ./bison {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
busybox-static = callPackage ./busybox/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
busybox-static = callPackage ./busybox/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
bzip2 = callPackage ./bzip2 {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
bzip2 = callPackage ./bzip2 {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
bzip2-static = callPackage ./bzip2/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
bzip2-static = callPackage ./bzip2/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
coreutils = callPackage ./coreutils { tinycc = tinycc-mes; };
coreutils = callPackage ./coreutils { tinycc = tinycc-mes; };
coreutils-musl = callPackage ./coreutils/musl.nix {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
coreutils-static = callPackage ./coreutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
diffutils = callPackage ./diffutils {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
diffutils-static = callPackage ./diffutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
findutils = callPackage ./findutils {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
gawk-mes = callPackage ./gawk/mes.nix {
bash = bash_2_05;
tinycc = tinycc-mes;
gnused = gnused-mes;
};
findutils-static = callPackage ./findutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gawk = callPackage ./gawk {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
bootGawk = gawk-mes;
};
gcc46 = callPackage ./gcc/4.6.nix {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
gcc46-cxx = callPackage ./gcc/4.6.cxx.nix {
gcc = gcc46;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
gcc10 = callPackage ./gcc/10.nix {
gcc = gcc46-cxx;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gcc-latest = callPackage ./gcc/latest.nix {
gcc = gcc10;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gcc-glibc = callPackage ./gcc/glibc.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
glibc = callPackage ./glibc {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
gnugrep = gnugrep-static;
};
gnugrep = callPackage ./gnugrep {
bash = bash_2_05;
tinycc = tinycc-mes;
};
gnugrep-static = callPackage ./gnugrep/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnum4 = callPackage ./gnum4 {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnumake = callPackage ./gnumake { tinycc = tinycc-bootstrappable; };
gnumake-musl = callPackage ./gnumake/musl.nix {
bash = bash_2_05;
tinycc = tinycc-musl;
gawk = gawk-mes;
gnumakeBoot = gnumake;
};
gnumake-static = callPackage ./gnumake/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; };
gnupatch-static = callPackage ./gnupatch/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnused = callPackage ./gnused {
bash = bash_2_05;
tinycc = tinycc-musl;
gnused = gnused-mes;
};
gnused-mes = callPackage ./gnused/mes.nix {
bash = bash_2_05;
tinycc = tinycc-bootstrappable;
};
gnused-static = callPackage ./gnused/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnutar = callPackage ./gnutar/mes.nix {
bash = bash_2_05;
tinycc = tinycc-mes;
gnused = gnused-mes;
};
# FIXME: better package naming scheme
gnutar-latest = callPackage ./gnutar/latest.nix {
gcc = gcc46;
gnumake = gnumake-musl;
gnutarBoot = gnutar-musl;
};
gnutar-musl = callPackage ./gnutar/musl.nix {
bash = bash_2_05;
tinycc = tinycc-musl;
gnused = gnused-mes;
};
gnutar-static = callPackage ./gnutar/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutarBoot = gnutar-latest;
};
gzip-static = callPackage ./gzip/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gzip = callPackage ./gzip {
bash = bash_2_05;
tinycc = tinycc-bootstrappable;
gnused = gnused-mes;
};
heirloom = callPackage ./heirloom {
bash = bash_2_05;
tinycc = tinycc-mes;
};
heirloom-devtools = callPackage ./heirloom-devtools { tinycc = tinycc-mes; };
linux-headers = callPackage ./linux-headers {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
ln-boot = callPackage ./ln-boot { };
mes = callPackage ./mes { };
mes-libc = callPackage ./mes/libc.nix { };
musl-tcc-intermediate = callPackage ./musl/tcc.nix {
bash = bash_2_05;
tinycc = tinycc-mes;
gnused = gnused-mes;
};
musl-tcc = callPackage ./musl/tcc.nix {
bash = bash_2_05;
tinycc = tinycc-musl-intermediate;
gnused = gnused-mes;
};
musl = callPackage ./musl {
gcc = gcc46;
gnumake = gnumake-musl;
};
musl-static = callPackage ./musl/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
};
patchelf-static = callPackage ./patchelf/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
python = callPackage ./python {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
stage0-posix = callPackage ./stage0-posix { };
inherit (self.stage0-posix)
kaem
m2libc
mescc-tools
mescc-tools-extra
;
tinycc-bootstrappable = lib.recurseIntoAttrs (callPackage ./tinycc/bootstrappable.nix { });
tinycc-mes = lib.recurseIntoAttrs (callPackage ./tinycc/mes.nix { });
tinycc-musl-intermediate = lib.recurseIntoAttrs (
callPackage ./tinycc/musl.nix {
coreutils-musl = callPackage ./coreutils/musl.nix {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
coreutils-static = callPackage ./coreutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
diffutils = callPackage ./diffutils {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
diffutils-static = callPackage ./diffutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
findutils = callPackage ./findutils {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
findutils-static = callPackage ./findutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gawk-mes = callPackage ./gawk/mes.nix {
bash = bash_2_05;
musl = musl-tcc-intermediate;
tinycc = tinycc-mes;
}
);
gnused = gnused-mes;
};
tinycc-musl = lib.recurseIntoAttrs (
callPackage ./tinycc/musl.nix {
gawk = callPackage ./gawk {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
bootGawk = gawk-mes;
};
gcc46 = callPackage ./gcc/4.6.nix {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
gcc46-cxx = callPackage ./gcc/4.6.cxx.nix {
gcc = gcc46;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
gcc10 = callPackage ./gcc/10.nix {
gcc = gcc46-cxx;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gcc-latest = callPackage ./gcc/latest.nix {
gcc = gcc10;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnugrep = callPackage ./gnugrep {
bash = bash_2_05;
tinycc = tinycc-mes;
};
gnugrep-static = callPackage ./gnugrep/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnum4 = callPackage ./gnum4 {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnumake = callPackage ./gnumake { tinycc = tinycc-bootstrappable; };
gnumake-musl = callPackage ./gnumake/musl.nix {
bash = bash_2_05;
tinycc = tinycc-musl;
gawk = gawk-mes;
gnumakeBoot = gnumake;
};
gnumake-static = callPackage ./gnumake/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; };
gnupatch-static = callPackage ./gnupatch/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnused = callPackage ./gnused {
bash = bash_2_05;
tinycc = tinycc-musl;
gnused = gnused-mes;
};
gnused-mes = callPackage ./gnused/mes.nix {
bash = bash_2_05;
tinycc = tinycc-bootstrappable;
};
gnused-static = callPackage ./gnused/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gnutar = callPackage ./gnutar/mes.nix {
bash = bash_2_05;
tinycc = tinycc-mes;
gnused = gnused-mes;
};
# FIXME: better package naming scheme
gnutar-latest = callPackage ./gnutar/latest.nix {
gcc = gcc46;
gnumake = gnumake-musl;
gnutarBoot = gnutar-musl;
};
gnutar-musl = callPackage ./gnutar/musl.nix {
bash = bash_2_05;
tinycc = tinycc-musl;
gnused = gnused-mes;
};
gnutar-static = callPackage ./gnutar/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutarBoot = gnutar-latest;
};
gzip-static = callPackage ./gzip/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gzip = callPackage ./gzip {
bash = bash_2_05;
tinycc = tinycc-bootstrappable;
gnused = gnused-mes;
};
heirloom = callPackage ./heirloom {
bash = bash_2_05;
tinycc = tinycc-mes;
};
heirloom-devtools = callPackage ./heirloom-devtools { tinycc = tinycc-mes; };
linux-headers = callPackage ./linux-headers {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
ln-boot = callPackage ./ln-boot { };
mes = callPackage ./mes { };
mes-libc = callPackage ./mes/libc.nix { };
musl-tcc-intermediate = callPackage ./musl/tcc.nix {
bash = bash_2_05;
tinycc = tinycc-mes;
gnused = gnused-mes;
};
musl-tcc = callPackage ./musl/tcc.nix {
bash = bash_2_05;
musl = musl-tcc;
tinycc = tinycc-musl-intermediate;
}
);
gnused = gnused-mes;
};
gawk-static = callPackage ./gawk/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
musl = callPackage ./musl {
gcc = gcc46;
gnumake = gnumake-musl;
};
xz = callPackage ./xz {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
musl-static = callPackage ./musl/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
};
xz-static = callPackage ./xz/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
patchelf-static = callPackage ./patchelf/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
zlib = callPackage ./zlib {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
python = callPackage ./python {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText;
test = kaem.runCommand "minimal-bootstrap-test" { } (
''
echo ${bash.tests.get-version}
echo ${bash-static.tests.get-version}
echo ${bash_2_05.tests.get-version}
echo ${binutils.tests.get-version}
echo ${binutils-static.tests.get-version}
echo ${bison.tests.get-version}
echo ${busybox-static.tests.get-version}
echo ${bzip2.tests.get-version}
echo ${bzip2-static.tests.get-version}
echo ${coreutils-musl.tests.get-version}
echo ${coreutils-static.tests.get-version}
echo ${diffutils.tests.get-version}
echo ${diffutils-static.tests.get-version}
echo ${findutils.tests.get-version}
echo ${findutils-static.tests.get-version}
echo ${gawk.tests.get-version}
echo ${gawk-mes.tests.get-version}
echo ${gawk-static.tests.get-version}
echo ${gcc46.tests.get-version}
echo ${gcc46-cxx.tests.hello-world}
echo ${gcc10.tests.hello-world}
echo ${gcc-latest.tests.hello-world}
echo ${gnugrep.tests.get-version}
echo ${gnugrep-static.tests.get-version}
echo ${gnum4.tests.get-version}
echo ${gnumake-musl.tests.get-version}
echo ${gnumake-static.tests.get-version}
echo ${gnupatch-static.tests.get-version}
echo ${gnused.tests.get-version}
echo ${gnused-mes.tests.get-version}
echo ${gnused-static.tests.get-version}
echo ${gnutar.tests.get-version}
echo ${gnutar-latest.tests.get-version}
echo ${gnutar-musl.tests.get-version}
echo ${gnutar-static.tests.get-version}
echo ${gzip.tests.get-version}
echo ${gzip-static.tests.get-version}
echo ${heirloom.tests.get-version}
echo ${mes.compiler.tests.get-version}
echo ${musl.tests.hello-world}
echo ${patchelf-static.tests.get-version}
echo ${python.tests.get-version}
echo ${tinycc-mes.compiler.tests.chain}
echo ${tinycc-musl.compiler.tests.hello-world}
echo ${xz.tests.get-version}
''
+ (lib.strings.optionalString (hostPlatform.libc == "glibc") ''
echo ${gcc-glibc.tests.hello-world}
echo ${glibc.tests.hello-world}
'')
+ ''
mkdir ''${out}
''
);
}
stage0-posix = callPackage ./stage0-posix { };
inherit (self.stage0-posix)
kaem
m2libc
mescc-tools
mescc-tools-extra
;
tinycc-bootstrappable = lib.recurseIntoAttrs (callPackage ./tinycc/bootstrappable.nix { });
tinycc-mes = lib.recurseIntoAttrs (callPackage ./tinycc/mes.nix { });
tinycc-musl-intermediate = lib.recurseIntoAttrs (
callPackage ./tinycc/musl.nix {
bash = bash_2_05;
musl = musl-tcc-intermediate;
tinycc = tinycc-mes;
}
);
tinycc-musl = lib.recurseIntoAttrs (
callPackage ./tinycc/musl.nix {
bash = bash_2_05;
musl = musl-tcc;
tinycc = tinycc-musl-intermediate;
}
);
gawk-static = callPackage ./gawk/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
xz = callPackage ./xz {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
xz-static = callPackage ./xz/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
zlib = callPackage ./zlib {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText;
test = kaem.runCommand "minimal-bootstrap-test" { } (
''
echo ${bash.tests.get-version}
echo ${bash-static.tests.get-version}
echo ${bash_2_05.tests.get-version}
echo ${binutils.tests.get-version}
echo ${binutils-static.tests.get-version}
echo ${bison.tests.get-version}
echo ${busybox-static.tests.get-version}
echo ${bzip2.tests.get-version}
echo ${bzip2-static.tests.get-version}
echo ${coreutils-musl.tests.get-version}
echo ${coreutils-static.tests.get-version}
echo ${diffutils.tests.get-version}
echo ${diffutils-static.tests.get-version}
echo ${findutils.tests.get-version}
echo ${findutils-static.tests.get-version}
echo ${gawk.tests.get-version}
echo ${gawk-mes.tests.get-version}
echo ${gawk-static.tests.get-version}
echo ${gcc46.tests.get-version}
echo ${gcc46-cxx.tests.hello-world}
echo ${gcc10.tests.hello-world}
echo ${gcc-latest.tests.hello-world}
echo ${gnugrep.tests.get-version}
echo ${gnugrep-static.tests.get-version}
echo ${gnum4.tests.get-version}
echo ${gnumake-musl.tests.get-version}
echo ${gnumake-static.tests.get-version}
echo ${gnupatch-static.tests.get-version}
echo ${gnused.tests.get-version}
echo ${gnused-mes.tests.get-version}
echo ${gnused-static.tests.get-version}
echo ${gnutar.tests.get-version}
echo ${gnutar-latest.tests.get-version}
echo ${gnutar-musl.tests.get-version}
echo ${gnutar-static.tests.get-version}
echo ${gzip.tests.get-version}
echo ${gzip-static.tests.get-version}
echo ${heirloom.tests.get-version}
echo ${mes.compiler.tests.get-version}
echo ${musl.tests.hello-world}
echo ${patchelf-static.tests.get-version}
echo ${python.tests.get-version}
echo ${tinycc-mes.compiler.tests.chain}
echo ${tinycc-musl.compiler.tests.hello-world}
echo ${xz.tests.get-version}
''
+ (lib.strings.optionalString (hostPlatform.libc == "glibc") ''
echo ${gcc-glibc.tests.hello-world}
echo ${glibc.tests.hello-world}
'')
+ ''
mkdir ''${out}
''
);
}
// (lib.optionalAttrs (hostPlatform.libc == "glibc")) {
gcc-glibc = callPackage ./gcc/glibc.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
glibc = callPackage ./glibc {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
gnugrep = gnugrep-static;
};
}
)
)
@@ -1,21 +0,0 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=i686-unknown-linux-gnu
#
# Metadata:
# - nixpkgs revision: 125cefd4cf8f857e5ff1aceaef9230ba578a033d
# - hydra build: https://hydra.nixos.org/job/nixpkgs/trunk/stdenvBootstrapTools.i686-unknown-linux-gnu.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/247889988
# - instantiated derivation: /nix/store/chcf0brhdyn7ihmb14n0w4rm2a59gqrw-stdenv-bootstrap-tools.drv
# - output directory: /nix/store/5x6dldhza7if5s6wsicaxa8fbndyixps-stdenv-bootstrap-tools
# - build time: Fri, 26 Jan 2024 22:04:03 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/i686-unknown-linux-gnu/125cefd4cf8f857e5ff1aceaef9230ba578a033d/bootstrap-tools.tar.xz";
hash = "sha256-KTAh3t91aJMiMO/7NFOjUz6fXI9Iu+H7cuODreWz9N8=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/i686-unknown-linux-gnu/125cefd4cf8f857e5ff1aceaef9230ba578a033d/busybox";
hash = "sha256-omz+ZT0bhMkAZcDs9evA2PNpO6VHUozdtjMgdui6fxw=";
executable = true;
};
}
@@ -1,21 +0,0 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=x86_64-unknown-linux-gnu
#
# Metadata:
# - nixpkgs revision: 82b583ba2ba2e5706b35dbe23f31362e62be2a9d
# - hydra build: https://hydra.nixos.org/job/nixpkgs/trunk/stdenvBootstrapTools.x86_64-unknown-linux-gnu.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/249165517
# - instantiated derivation: /nix/store/7g8mrv13mi4zrx66fw0hy4c46j752wfd-stdenv-bootstrap-tools.drv
# - output directory: /nix/store/dw6vr6m5w7ysrdrbs0s5wdgbjmbnr7gx-stdenv-bootstrap-tools
# - build time: Sat, 10 Feb 2024 01:29:55 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-gnu/82b583ba2ba2e5706b35dbe23f31362e62be2a9d/bootstrap-tools.tar.xz";
hash = "sha256-YQlr088HPoVWBU2jpPhpIMyOyoEDZYDw1y60SGGbUM0=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-gnu/82b583ba2ba2e5706b35dbe23f31362e62be2a9d/busybox";
hash = "sha256-QrTEnQTBM1Y/qV9odq8irZkQSD9uOMbs2Q5NgCvKCNQ=";
executable = true;
};
}
@@ -1,21 +0,0 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=x86_64-unknown-linux-musl
#
# Metadata:
# - nixpkgs revision: 8c29968b3a942f2903f90797f9623737c215737c
# - hydra build: https://hydra.nixos.org/job/nixpkgs/trunk/stdenvBootstrapTools.x86_64-unknown-linux-musl.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/315356522
# - instantiated derivation: /nix/store/783rl6mlrc2wpp9apclcvc8x7vwi842s-stdenv-bootstrap-tools.drv
# - output directory: /nix/store/f881dxkvjal4vflnznfbz7g6pn4q0c56-stdenv-bootstrap-tools
# - build time: Mon, 01 Dec 2025 18:29:47 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-musl/8c29968b3a942f2903f90797f9623737c215737c/bootstrap-tools.tar.xz";
hash = "sha256-WwA4q0JNEdnSAhTwcPGIrwuOha33T0aRG7tR/YgA7L4=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-musl/8c29968b3a942f2903f90797f9623737c215737c/busybox";
hash = "sha256-XJTiB2U3KkP31G5s68Ho7wQY5yz72CZkLSarR+56zKw=";
executable = true;
};
}
+22 -72
View File
@@ -65,8 +65,6 @@
let
table = {
glibc = {
i686-linux = import ./bootstrap-files/i686-unknown-linux-gnu.nix;
x86_64-linux = import ./bootstrap-files/x86_64-unknown-linux-gnu.nix;
armv5tel-linux = import ./bootstrap-files/armv5tel-unknown-linux-gnueabi.nix;
armv6l-linux = import ./bootstrap-files/armv6l-unknown-linux-gnueabihf.nix;
armv7l-linux = import ./bootstrap-files/armv7l-unknown-linux-gnueabihf.nix;
@@ -92,7 +90,6 @@
musl = {
aarch64-linux = import ./bootstrap-files/aarch64-unknown-linux-musl.nix;
armv6l-linux = import ./bootstrap-files/armv6l-unknown-linux-musleabihf.nix;
x86_64-linux = import ./bootstrap-files/x86_64-unknown-linux-musl.nix;
};
};
@@ -127,7 +124,8 @@ let
inherit (localSystem) system;
isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
isFromBootstrapFiles = pkg: pkg.passthru.isFromBootstrapFiles or false;
isFromBootstrapFiles =
pkg: pkg.passthru.isFromBootstrapFiles or pkg.passthru.isFromMinBootstrap or false;
isBuiltByNixpkgsCompiler = pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
isBuiltByBootstrapFilesCompiler = pkg: isFromNixpkgs pkg && isFromBootstrapFiles pkg.stdenv.cc.cc;
@@ -155,12 +153,13 @@ let
# Create a standard environment by downloading pre-built binaries of
# coreutils, GCC, etc.
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
bootstrapTools = import ./bootstrap-tools {
inherit (localSystem) libc system;
inherit lib bootstrapFiles config;
isFromBootstrapFiles = true;
stage0 = import ./stage0.nix {
inherit
lib
config
localSystem
bootstrapFiles
;
};
# This function builds the various standard environments used during
@@ -175,21 +174,20 @@ let
}:
let
thisStdenv = import ../generic {
name = "${name}-stdenv-linux";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config extraNativeBuildInputs;
inherit (stage0) initialPath;
preHook = ''
# Don't patch #!/interpreter because it leads to retained
# dependencies on the bootstrapTools in the final stdenv.
dontPatchShebangs=1
${commonPreHook}
'';
shell = "${bootstrapTools}/bin/bash";
initialPath = [ bootstrapTools ];
shell = "${stage0.bash}/bin/bash";
fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
inherit system;
@@ -237,7 +235,6 @@ let
};
in
assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
[
(
@@ -254,60 +251,7 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
# Build a dummy stdenv with no GCC or working fetchurl. This is
# because we need a stdenv to build the GCC wrapper and fetchurl.
(
prevStage:
stageFun prevStage {
name = "bootstrap-stage0";
overrides = self: super: {
# We thread stage0's stdenv through under this name so downstream stages
# can use it for wrapping gcc too. This way, downstream stages don't need
# to refer to this stage directly, which violates the principle that each
# stage should only access the stage that came before it.
ccWrapperStdenv = self.stdenv;
# The Glibc include directory cannot have the same prefix as the
# GCC include directory, since GCC gets confused otherwise (it
# will search the Glibc headers before the GCC headers). So
# create a dummy Glibc here, which will be used in the stdenv of
# stage1.
${localSystem.libc} = self.stdenv.mkDerivation {
pname = "bootstrap-stage0-${localSystem.libc}";
strictDeps = true;
version = "bootstrapFiles";
enableParallelBuilding = true;
buildCommand = ''
mkdir -p $out
ln -s ${bootstrapTools}/lib $out/lib
''
+ lib.optionalString (localSystem.libc == "glibc") ''
ln -s ${bootstrapTools}/include-glibc $out/include
''
+ lib.optionalString (localSystem.libc == "musl") ''
ln -s ${bootstrapTools}/include-libc $out/include
'';
passthru.isFromBootstrapFiles = true;
};
gcc-unwrapped = bootstrapTools;
binutils = import ../../build-support/bintools-wrapper {
name = "bootstrap-stage0-binutils-wrapper";
nativeTools = false;
nativeLibc = false;
expand-response-params = "";
inherit lib;
inherit (self)
stdenvNoCC
coreutils
gnugrep
libc
;
bintools = bootstrapTools;
runtimeShell = "${bootstrapTools}/bin/bash";
};
coreutils = bootstrapTools;
gnugrep = bootstrapTools;
};
}
)
(prevStage: stageFun prevStage stage0.dummyStdenv)
# Create the first "real" standard environment. This one consists
# of bootstrap tools only, and a minimal Glibc to keep the GCC
@@ -407,7 +351,7 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
# Historically, the wrapper didn't use runtimeShell, so the used shell had to be changed explicitly
# (or stdenvNoCC.shell would be used) which happened in stage4.
binutils = super.binutils.override {
runtimeShell = "${bootstrapTools}/bin/bash";
runtimeShell = "${stage0.bash}/bin/bash";
};
gcc-unwrapped =
(super.gcc-unwrapped.override (
@@ -781,11 +725,17 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
inherit (prevStage.stdenv) fetchurlBoot;
extraAttrs = {
inherit bootstrapTools;
inherit stage0;
shellPackage = prevStage.bash;
};
}
// (lib.optionalAttrs stage0.isMinimalBootstrap {
inherit (stage0) minimal-bootstrap;
})
// (lib.optionalAttrs (!stage0.isMinimalBootstrap) {
inherit (stage0) bootstrapTools;
});
disallowedRequisites = [ bootstrapTools.out ];
disallowedRequisites = stage0.disallowedInFinalStdenv;
# Mainly avoid reference to bootstrap tools
allowedRequisites =
@@ -43,6 +43,5 @@ lib.mapAttrs (n: make) (
aarch64-unknown-linux-musl = aarch64-multiplatform-musl;
armv6l-unknown-linux-musleabihf = muslpi;
riscv64-unknown-linux-musl = riscv64-musl;
x86_64-unknown-linux-musl = musl64;
}
)
+185
View File
@@ -0,0 +1,185 @@
{
localSystem,
config,
lib,
bootstrapFiles,
}:
let
minbootSupportedSystems = [
"i686-linux"
"x86_64-linux"
];
minbootSupported = builtins.elem localSystem.system minbootSupportedSystems;
in
if minbootSupported then
let
callPackage = lib.callPackageWith { inherit lib config; };
minimal-bootstrap = lib.recurseIntoAttrs (
import ../../os-specific/linux/minimal-bootstrap {
buildPlatform = localSystem;
hostPlatform = localSystem;
inherit lib config;
fetchurl = import ../../build-support/fetchurl/boot.nix {
system = localSystem;
inherit (config) rewriteURL;
};
checkMeta = callPackage ../generic/check-meta.nix { hostPlatform = localSystem; };
}
);
compilerPackage =
if localSystem.libc == "glibc" then
minimal-bootstrap.gcc-glibc
else if localSystem.libc == "musl" then
minimal-bootstrap.gcc-latest
else
throw "Can't bootstrap on ${localSystem.config}";
libcPackage =
if localSystem.libc == "glibc" then
minimal-bootstrap.glibc
else if localSystem.libc == "musl" then
minimal-bootstrap.musl-static
else
throw "Can't bootstrap on ${localSystem.config}";
in
assert minimal-bootstrap.bash-static.passthru.isFromMinBootstrap or false; # sanity check
{
inherit minimal-bootstrap;
isMinimalBootstrap = true;
dummyStdenv = {
name = "bootstrap-stage0";
overrides = self: super: {
# We thread stage0's stdenv through under this name so downstream stages
# can use it for wrapping gcc too. This way, downstream stages don't need
# to refer to this stage directly, which violates the principle that each
# stage should only access the stage that came before it.
ccWrapperStdenv = self.stdenv;
# The Glibc include directory cannot have the same prefix as the
# GCC include directory, since GCC gets confused otherwise (it
# will search the Glibc headers before the GCC headers). So
# create a dummy Glibc here, which will be used in the stdenv of
# stage1.
${localSystem.libc} = self.stdenv.mkDerivation {
pname = "bootstrap-stage0-${localSystem.libc}";
strictDeps = true;
version = "minimal-bootstrap";
enableParallelBuilding = true;
buildCommand = ''
mkdir -p $out
ln -s ${libcPackage}/lib $out/lib
ln -s ${libcPackage}/include $out/include
'';
passthru.isFromBootstrapFiles = true;
};
gcc-unwrapped = compilerPackage;
binutils = import ../../build-support/bintools-wrapper {
name = "bootstrap-stage0-binutils-wrapper";
nativeTools = false;
nativeLibc = false;
expand-response-params = "";
inherit lib;
inherit (self)
stdenvNoCC
coreutils
gnugrep
libc
;
bintools = minimal-bootstrap.binutils-static;
runtimeShell = "${minimal-bootstrap.bash}/bin/bash";
};
coreutils = minimal-bootstrap.coreutils-static;
gnugrep = minimal-bootstrap.gnugrep-static;
};
};
bash = minimal-bootstrap.bash-static;
initialPath = with minimal-bootstrap; [
bash-static
binutils-static
bzip2-static
compilerPackage
coreutils-static
diffutils-static
findutils-static
gawk-static
gnugrep-static
gnumake-static
gnupatch-static
gnused-static
gnutar-static
gzip-static
patchelf-static
xz-static
];
disallowedInFinalStdenv = lib.attrsets.catAttrs "out" (
builtins.filter (drv: lib.attrsets.isDerivation drv) (builtins.attrValues minimal-bootstrap)
);
}
else
let
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
bootstrapTools = import ./bootstrap-tools {
inherit (localSystem) libc system;
inherit lib bootstrapFiles config;
isFromBootstrapFiles = true;
};
in
assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
{
inherit bootstrapTools;
isMinimalBootstrap = false;
dummyStdenv = {
name = "bootstrap-stage0";
overrides = self: super: {
# We thread stage0's stdenv through under this name so downstream stages
# can use it for wrapping gcc too. This way, downstream stages don't need
# to refer to this stage directly, which violates the principle that each
# stage should only access the stage that came before it.
ccWrapperStdenv = self.stdenv;
# The Glibc include directory cannot have the same prefix as the
# GCC include directory, since GCC gets confused otherwise (it
# will search the Glibc headers before the GCC headers). So
# create a dummy Glibc here, which will be used in the stdenv of
# stage1.
${localSystem.libc} = self.stdenv.mkDerivation {
pname = "bootstrap-stage0-${localSystem.libc}";
strictDeps = true;
version = "bootstrap-tools";
enableParallelBuilding = true;
buildCommand = ''
mkdir -p $out
ln -s ${bootstrapTools}/lib $out/lib
''
+ lib.optionalString (localSystem.libc == "glibc") ''
ln -s ${bootstrapTools}/include-glibc $out/include
''
+ lib.optionalString (localSystem.libc == "musl") ''
ln -s ${bootstrapTools}/include-libc $out/include
'';
passthru.isFromBootstrapFiles = true;
};
gcc-unwrapped = bootstrapTools;
binutils = import ../../build-support/bintools-wrapper {
name = "bootstrap-stage0-binutils-wrapper";
nativeTools = false;
nativeLibc = false;
expand-response-params = "";
inherit lib;
inherit (self)
stdenvNoCC
coreutils
gnugrep
libc
;
bintools = bootstrapTools;
runtimeShell = "${bootstrapTools}/bin/bash";
};
coreutils = bootstrapTools;
gnugrep = bootstrapTools;
};
};
bash = bootstrapTools;
initialPath = [ bootstrapTools ];
disallowedInFinalStdenv = [ bootstrapTools ];
}
+8 -8
View File
@@ -9,9 +9,10 @@
}:
let
# tests can be based on builtins.derivation and bootstrapTools directly to minimize rebuilds
# tests can be based on builtins.derivation and stage0 or bootstrapTools directly to minimize rebuilds
# see test 'make-symlinks-relative' in ./hooks.nix as an example.
bootstrapTools = stdenv.bootstrapTools;
initialBash = if stdenv ? stage0 then stdenv.stage0.bash else stdenv.bootstrapTools;
initialPath = if stdenv ? stage0 then stdenv.stage0.initialPath else [ stdenv.bootstrapTools ];
# early enough not to rebuild gcc but late enough to have patchelf
earlyPkgs = stdenv.__bootPackages.stdenv.__bootPackages or pkgs;
earlierPkgs =
@@ -243,7 +244,7 @@ in
import ./hooks.nix {
stdenv = bootStdenv;
pkgs = earlyPkgs;
inherit bootstrapTools lib;
inherit initialPath initialBash lib;
}
);
@@ -458,10 +459,9 @@ in
derivation {
name = "ensure-no-execve-in-setup-sh";
inherit (stdenv.hostPlatform) system;
builder = "${stdenv.bootstrapTools}/bin/bash";
PATH = "${pkgs.strace}/bin:${stdenv.bootstrapTools}/bin";
initialPath = [
stdenv.bootstrapTools
builder = "${initialBash}/bin/bash";
PATH = "${pkgs.strace}/bin:${lib.strings.makeSearchPath "bin" initialPath}";
initialPath = initialPath ++ [
pkgs.strace
];
args = [
@@ -504,7 +504,7 @@ in
import ./hooks.nix {
stdenv = bootStdenvStructuredAttrsByDefault;
pkgs = earlyPkgs;
inherit bootstrapTools lib;
inherit initialBash initialPath lib;
}
);
+5 -4
View File
@@ -1,5 +1,6 @@
{
bootstrapTools,
initialBash,
initialPath,
stdenv,
pkgs,
lib,
@@ -29,13 +30,13 @@
[[ -e $out/share/man/small-man.1.gz ]]
'';
};
# test based on bootstrapTools to minimize rebuilds
# test based on stage0 to minimize rebuilds
make-symlinks-relative =
(derivation {
name = "test-make-symlinks-relative";
system = stdenv.system;
builder = "${bootstrapTools}/bin/bash";
initialPath = "${bootstrapTools}";
builder = "${initialBash}/bin/bash";
inherit initialPath;
outputs = [
"out"
"out2"
+3 -3
View File
@@ -73,9 +73,9 @@ self: super: {
# All packages built with the Musl libc. This will override the
# default GNU libc on Linux systems. Non-Linux systems are not
# supported. 32-bit is also not supported.
# supported. 32-bit is also not supported, except for x86.
pkgsMusl =
if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then
if stdenv.hostPlatform.isLinux && (stdenv.buildPlatform.is64bit || stdenv.buildPlatform.isx86) then
nixpkgsFun {
overlays = [
(self': super': {
@@ -88,7 +88,7 @@ self: super: {
};
}
else
throw "Musl libc only supports 64-bit Linux systems.";
throw "Musl libc only supports 64-bit Linux systems, and i686-linux.";
# x86_64-darwin packages for aarch64-darwin users to use with Rosetta for incompatible packages
pkgsx86_64Darwin =