push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
{
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/aarch64/21ec906463ea8f11abf3f9091ddd4c3276516e58/busybox";
executable = true;
hash = "sha256-0MuIeQlBUaeisqoFSu8y+8oB6K4ZG5Lhq8RcS9JqkFQ=";
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/aarch64/21ec906463ea8f11abf3f9091ddd4c3276516e58/bootstrap-tools.tar.xz";
hash = "sha256-aJvtsWeuQHbb14BGZ2EiOKzjQn46h3x3duuPEawG0eE=";
};
}

View File

@@ -0,0 +1,25 @@
#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/246470544
#
# …which used nixpkgs revision dd5621df6dcb90122b50da5ec31c411a0de3e538
# to instantiate:
#
# /nix/store/g480ass2vjmakaq03z7k2j95xnxh206a-stdenv-bootstrap-tools.drv
#
# …and then built:
#
# /nix/store/95lm0y33dayag4542s8bi83s31bw68dr-stdenv-bootstrap-tools
#
{
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/aarch64-unknown-linux-musl/dd5621df6dcb90122b50da5ec31c411a0de3e538/busybox";
sha256 = "sha256-WuOaun7U5enbOy8SuuCo6G1fbGwsO16jhy/oM8K0lAs=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/aarch64-unknown-linux-musl/dd5621df6dcb90122b50da5ec31c411a0de3e538/bootstrap-tools.tar.xz";
hash = "sha256-ZY9IMOmx1VOn6uoFDpdJbTnPX59TEkrVCzWNtjQ8/QE=";
};
}

View File

@@ -0,0 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=armv5tel-unknown-linux-gnueabi
#
# Metadata:
# - nixpkgs revision: 029dea9aaacf920ce8f7d89e4cf09da31a38d8e1
# - hydra build: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv5tel-unknown-linux-gnueabi.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/281086357
# - instantiated derivation: /nix/store/j44ipis8k634n1a6j9j1blff88w13ix9-stdenv-bootstrap-tools-armv5tel-unknown-linux-gnueabi.drv
# - output directory: /nix/store/7xapg8fj3p2fpmnppsd28a66q62vzdg1-stdenv-bootstrap-tools-armv5tel-unknown-linux-gnueabi
# - build time: Tue, 03 Dec 2024 13:59:40 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/armv5tel-unknown-linux-gnueabi/029dea9aaacf920ce8f7d89e4cf09da31a38d8e1/bootstrap-tools.tar.xz";
hash = "sha256-+7cdKUThhOb4pVFBjPWFpBbTfn64A/ezkZnP6hEhMRM=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/armv5tel-unknown-linux-gnueabi/029dea9aaacf920ce8f7d89e4cf09da31a38d8e1/busybox";
hash = "sha256-vZ3oSKUjGVcx2TJsrKmTX4d+3S4/flD780vFVaaHDGI=";
executable = true;
};
}

View File

@@ -0,0 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=armv6l-unknown-linux-gnueabihf
#
# Metadata:
# - nixpkgs revision: 029dea9aaacf920ce8f7d89e4cf09da31a38d8e1
# - hydra build: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv6l-unknown-linux-gnueabihf.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/281086894
# - instantiated derivation: /nix/store/gq29b3av5mf7x9zlbvaf1qrvlnb1ps4l-stdenv-bootstrap-tools-armv6l-unknown-linux-gnueabihf.drv
# - output directory: /nix/store/cwfvh58lcbyk26d34j1w26d3ladgcgn8-stdenv-bootstrap-tools-armv6l-unknown-linux-gnueabihf
# - build time: Tue, 03 Dec 2024 13:59:47 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/armv6l-unknown-linux-gnueabihf/029dea9aaacf920ce8f7d89e4cf09da31a38d8e1/bootstrap-tools.tar.xz";
hash = "sha256-IOZRTJRvoP0bIz5GI6GqGAYb/FdME+xVVyFTvgtmLuw=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/armv6l-unknown-linux-gnueabihf/029dea9aaacf920ce8f7d89e4cf09da31a38d8e1/busybox";
hash = "sha256-kdlAOhgypLa+ZesRT1ZVDoDQdNefV1Rx5Yf7H254o80=";
executable = true;
};
}

View File

@@ -0,0 +1,11 @@
{
busybox = import <nix/fetchurl.nix> {
url = "https://wdtz.org/files/xmz441m69qrlfdw47l2k10zf87fsya6r-stdenv-bootstrap-tools-armv6l-unknown-linux-musleabihf/on-server/busybox";
sha256 = "01d0hp1xgrriiy9w0sd9vbqzwxnpwiyah80pi4vrpcmbwji36j1i";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "https://wdtz.org/files/xmz441m69qrlfdw47l2k10zf87fsya6r-stdenv-bootstrap-tools-armv6l-unknown-linux-musleabihf/on-server/bootstrap-tools.tar.xz";
sha256 = "1r9mz9w8y5jd7gfwfsrvs20qarzxy7bvrp5dlm41hnx6z617if1h";
};
}

View File

@@ -0,0 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=armv7l-unknown-linux-gnueabihf
#
# Metadata:
# - nixpkgs revision: b92edf1104c47016385e85c87c2d953cf5cd2f98
# - hydra build: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv7l-unknown-linux-gnueabihf.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/276944599
# - instantiated derivation: /nix/store/ldvkcqvzvwqv6frf6aqkl44jja88gvbx-stdenv-bootstrap-tools-armv7l-unknown-linux-gnueabihf.drv
# - output directory: /nix/store/y2xac60x8qkli271qn4dz78lzm2sqiv8-stdenv-bootstrap-tools-armv7l-unknown-linux-gnueabihf
# - build time: Thu, 31 Oct 2024 20:57:35 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/armv7l-unknown-linux-gnueabihf/b92edf1104c47016385e85c87c2d953cf5cd2f98/bootstrap-tools.tar.xz";
hash = "sha256-FpBUnMI20l4LVdtmPpaGWP5+V52ZpvAH1JmHkOqFhCI=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/armv7l-unknown-linux-gnueabihf/b92edf1104c47016385e85c87c2d953cf5cd2f98/busybox";
hash = "sha256-LSK7lkzpD1Zv5aFzp45W+3JGLi8iqOIk8brl1TNIl4g=";
executable = true;
};
}

View File

@@ -0,0 +1,21 @@
# 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;
};
}

View File

@@ -0,0 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=loongarch64-unknown-linux-gnu
#
# Metadata:
# - nixpkgs revision: bdcacf48f3b064c93a9064d1d545f75c60ca6c77
# - hydra build: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.loongarch64-unknown-linux-gnu.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/295459473
# - instantiated derivation: /nix/store/q7r692xs6kpsyipmkfamhj36va79wa5r-stdenv-bootstrap-tools-loongarch64-unknown-linux-gnu.drv
# - output directory: /nix/store/gvjaqdhmvsqn821iypwj0cb8xq8yiii6-stdenv-bootstrap-tools-loongarch64-unknown-linux-gnu
# - build time: Wed, 23 Apr 2025 12:35:42 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/loongarch64-unknown-linux-gnu/bdcacf48f3b064c93a9064d1d545f75c60ca6c77/bootstrap-tools.tar.xz";
hash = "sha256-Yx0YmbVElsbN0VKgPiKfm7+e3ed5JXu3vZv0kKIhER8=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/loongarch64-unknown-linux-gnu/bdcacf48f3b064c93a9064d1d545f75c60ca6c77/busybox";
hash = "sha256-0UFp0zpeC8oTmS5/XJoMFnnOMTVTciQYmO/0JAi6uqk=";
executable = true;
};
}

View File

@@ -0,0 +1,25 @@
#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/182757245
#
# Which used nixpkgs revision ef3fe254f3c59455386bc92fe84164f9679b92b1
# to instantiate:
#
# /nix/store/a2bvv663wjnyhq8m7v84aspsd3sgf9h6-stdenv-bootstrap-tools-mips64el-unknown-linux-gnuabi64.drv
#
# and then built:
#
# /nix/store/aw3dmsrh22831l83vi3q9apg9qi3x8ms-stdenv-bootstrap-tools-mips64el-unknown-linux-gnuabi64
#
{
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/mips64el/ef3fe254f3c59455386bc92fe84164f9679b92b1/busybox";
sha256 = "sha256-sTE58ofjqAqX3Xtq1g9wDxzIe6Vo//GHbicfqJoivDI=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/mips64el/ef3fe254f3c59455386bc92fe84164f9679b92b1/bootstrap-tools.tar.xz";
sha256 = "sha256-tTgjeXpd2YgnfP4JvRuO0bXd2j8GqzBcd57JI3wH9x0=";
};
}

View File

@@ -0,0 +1,25 @@
#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/188389586
#
# Which used nixpkgs revision 97d9c84e1df4397b43ecb39359f1bd003cd44585
# to instantiate:
#
# /nix/store/hakn8s85s9011v61r6svp5qy8x1y64fv-stdenv-bootstrap-tools-mips64el-unknown-linux-gnuabin32.drv
#
# and then built:
#
# /nix/store/rjgybpnf3yiqyhvl2n2lx31jf800fii2-stdenv-bootstrap-tools-mips64el-unknown-linux-gnuabin32
#
{
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/mips64el-n32/97d9c84e1df4397b43ecb39359f1bd003cd44585/busybox";
sha256 = "sha256-4N3G1qYA7vitjhsIW17pR6UixIuzrq4vZXa8F0/X4iI=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/mips64el-n32/97d9c84e1df4397b43ecb39359f1bd003cd44585/bootstrap-tools.tar.xz";
sha256 = "sha256-LWrpN6su2yNVurUyhZP34OiZyzgh7MfN13fIIbou8KI=";
};
}

View File

@@ -0,0 +1,25 @@
#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/185311909
#
# Which used nixpkgs revision 5bd14b3cfe2f87a2e2b074645aba39c69563e4bc
# to instantiate:
#
# /nix/store/184fa520zv8ls9fzcqyfa5dmkp8kf6xr-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu.drv
#
# and then built:
#
# /nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu
#
{
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/busybox";
hash = "sha256-EhuzjL52VEIOfEcFdVGZaDMClQbMc9V9ISrTUNaA7HQ=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/bootstrap-tools.tar.xz";
hash = "sha256-OEGgLJOLnV+aobsb+P8mY3Dp8qbeVODBH6x3aUE/MGM=";
};
}

View File

@@ -0,0 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=powerpc64-unknown-linux-gnuabielfv1
#
# Metadata:
# - nixpkgs revision: 2ba17da62f2813a5b779ec2b13abe96baec8ea08
# - hydra build: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.powerpc64-unknown-linux-gnuabielfv1.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/301750343
# - instantiated derivation: /nix/store/4djsi9i5fc3nc7qzf4gjljn4zzjiy226-stdenv-bootstrap-tools-powerpc64-unknown-linux-gnuabielfv1.drv
# - output directory: /nix/store/b8zndw2p8f82hn23a3ilkmfc6v26yian-stdenv-bootstrap-tools-powerpc64-unknown-linux-gnuabielfv1
# - build time: Fri, 04 Jul 2025 13:37:14 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/powerpc64-unknown-linux-gnuabielfv1/2ba17da62f2813a5b779ec2b13abe96baec8ea08/bootstrap-tools.tar.xz";
hash = "sha256-OnjFUMRNFmGu0EFSM99loZ03Bx6htCyTiftCBO1enQM=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/powerpc64-unknown-linux-gnuabielfv1/2ba17da62f2813a5b779ec2b13abe96baec8ea08/busybox";
hash = "sha256-f5U+O8oHTAfJpukjz+YmIf8QQVuMoh+kKhOw5Zf5QJY=";
executable = true;
};
}

View File

@@ -0,0 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=powerpc64-unknown-linux-gnuabielfv2
#
# Metadata:
# - nixpkgs revision: 57cf2e0b24fb52344cc718913eaed78f389b1319
# - hydra build: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.powerpc64-unknown-linux-gnuabielfv2.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/252872323
# - instantiated derivation: /nix/store/yaa735jz1r1n863gzv3c8szl77lsgg8d-stdenv-bootstrap-tools-powerpc64-unknown-linux-gnuabielfv2.drv
# - output directory: /nix/store/8frm8kk8gzpv31r289ai5jgkwfikmpm4-stdenv-bootstrap-tools-powerpc64-unknown-linux-gnuabielfv2
# - build time: Sat, 09 Mar 2024 11:26:00 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/powerpc64-unknown-linux-gnuabielfv2/57cf2e0b24fb52344cc718913eaed78f389b1319/bootstrap-tools.tar.xz";
hash = "sha256-CvMRR2tUs5nzAkuS6cUYNjrNKxX3E+g9C7T7P48m2Ys=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/powerpc64-unknown-linux-gnuabielfv2/57cf2e0b24fb52344cc718913eaed78f389b1319/busybox";
hash = "sha256-+vnQrVBHg793JIdQR4Y9KuqdmNZ+Ic0FZvVqrPOKnOY=";
executable = true;
};
}

View File

@@ -0,0 +1,25 @@
#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/186237511
#
# Which used nixpkgs revision ac43c444780a80e789fd14fe2114acd4a3b5cf9d
# to instantiate:
#
# /nix/store/nhjbza9vlcyhp9zxfz6lwpc3m2ghrpzj-stdenv-bootstrap-tools-powerpc64le-unknown-linux-gnu.drv
#
# and then built:
#
# /nix/store/fklpm7fy6cp5wz55w0gd8wakyqvzapjx-stdenv-bootstrap-tools-powerpc64le-unknown-linux-gnu
#
{
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/ac43c444780a80e789fd14fe2114acd4a3b5cf9d/busybox";
sha256 = "sha256-jtPEAsht4AUAG4MLK8xocQSfveUR4ppU1lS4bGI1VN4=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/ac43c444780a80e789fd14fe2114acd4a3b5cf9d/bootstrap-tools.tar.xz";
sha256 = "sha256-MpIDnpZUK3M17qlnuoxfnK0EgxRosm3TMW1WfPZ1+jU=";
};
}

View File

@@ -0,0 +1,26 @@
#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/246376732
#
# Which used nixpkgs revision 160cedc144aced7a35a91440b46b74ffacd52682
# to instantiate:
#
# /nix/store/cpiajh4l83b08pynwiwkpxj53d78pcxr-stdenv-bootstrap-tools-riscv64-unknown-linux-gnu.drv
#
# and then built:
#
# /nix/store/8a92pj40awdw585mcb9dvm4nyb03k3q3-stdenv-bootstrap-tools-riscv64-unknown-linux-gnu
#
{
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/riscv64/160cedc144aced7a35a91440b46b74ffacd52682/busybox";
sha256 = "sha256-OGO96QUzs2n5pGipn/V87AxzUY9OWKZl417nE8HdZIE=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/riscv64/160cedc144aced7a35a91440b46b74ffacd52682/bootstrap-tools.tar.xz";
sha256 = "sha256-0LxRd7fdafQezNJ+N2tuOfm0KEwgfRSts5fhP0e0r0s=";
};
}

View File

@@ -0,0 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=s390x-unknown-linux-gnu
#
# Metadata:
# - nixpkgs revision: 0a7eaa55ccaa5103f44a9a4e3e0b06e5314a6401
# - hydra build: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.s390x-unknown-linux-gnu.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/268609502
# - instantiated derivation: /nix/store/x66rrb9wv612n37bj6iggr2vg313hs77-stdenv-bootstrap-tools-s390x-unknown-linux-gnu.drv
# - output directory: /nix/store/ijkl5anf7mx1p3whdkxv4qs5crf6ic35-stdenv-bootstrap-tools-s390x-unknown-linux-gnu
# - build time: Mon, 05 Aug 2024 17:28:42 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/s390x-unknown-linux-gnu/0a7eaa55ccaa5103f44a9a4e3e0b06e5314a6401/bootstrap-tools.tar.xz";
hash = "sha256-HYooNwkStp9Q1nZOw9celEiQPWwU7iSHP1iaxodBv1g=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/s390x-unknown-linux-gnu/0a7eaa55ccaa5103f44a9a4e3e0b06e5314a6401/busybox";
hash = "sha256-8BUGvp0gm4v3qBemF/kTVVCsu3ydWLGRVPulBsAL+MI=";
executable = true;
};
}

View File

@@ -0,0 +1,21 @@
# 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;
};
}

View File

@@ -0,0 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=x86_64-unknown-linux-musl
#
# Metadata:
# - nixpkgs revision: 125cefd4cf8f857e5ff1aceaef9230ba578a033d
# - 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/247890807
# - instantiated derivation: /nix/store/gqri9n85rsf2983r6m8lkz0h69k4n7xi-stdenv-bootstrap-tools.drv
# - output directory: /nix/store/b0x0qcbf1gsp50jzw52sbbgdp3jlwcjf-stdenv-bootstrap-tools
# - build time: Fri, 26 Jan 2024 22:09:22 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-musl/125cefd4cf8f857e5ff1aceaef9230ba578a033d/bootstrap-tools.tar.xz";
hash = "sha256-t0W2MR7UwtPyYEGcRo9UOuXfaP4uUZKZXEmYGcBOuOA=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-musl/125cefd4cf8f857e5ff1aceaef9230ba578a033d/busybox";
hash = "sha256-0U2r3EU61oqhs+oyzFABIFTCVqXOWSP0qEtnyHwjzm0=";
executable = true;
};
}

View File

@@ -0,0 +1,35 @@
{
lib,
libc,
config,
system,
bootstrapFiles,
isFromBootstrapFiles ? false,
}:
let
maybeDenoteProvenance = lib.optionalAttrs isFromBootstrapFiles {
passthru = {
inherit isFromBootstrapFiles;
};
};
maybeContentAddressed = lib.optionalAttrs config.contentAddressedByDefault {
__contentAddressed = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
args = {
inherit system bootstrapFiles;
extraAttrs = maybeContentAddressed;
};
result =
if libc == "glibc" then
import ./glibc.nix args
else if libc == "musl" then
import ./musl.nix args
else
throw "unsupported libc";
in
result // maybeDenoteProvenance

View File

@@ -0,0 +1,37 @@
{
system,
bootstrapFiles,
extraAttrs,
}:
derivation (
{
name = "bootstrap-tools";
builder = bootstrapFiles.busybox;
args = [
"ash"
"-e"
./glibc/unpack-bootstrap-tools.sh
];
tarball = bootstrapFiles.bootstrapTools;
inherit system;
# Needed by the GCC wrapper.
langC = true;
langCC = true;
isGNU = true;
hardeningUnsupportedFlags = [
"fortify3"
"shadowstack"
"pacret"
"stackclashprotection"
"trivialautovarinit"
"zerocallusedregs"
];
}
// extraAttrs
)

View File

@@ -0,0 +1,77 @@
# Unpack the bootstrap tools tarball.
echo Unpacking the bootstrap tools...
$builder mkdir $out
< $tarball $builder unxz | $builder tar x -C $out
# Set the ELF interpreter / RPATH in the bootstrap binaries.
echo Patching the bootstrap tools...
if test -f $out/lib/ld.so.?; then
# MIPS case
LD_BINARY=$out/lib/ld.so.?
elif test -f $out/lib/ld64.so.?; then
# ppc64(le)
LD_BINARY=$out/lib/ld64.so.?
else
# i686, x86_64 and armv5tel
LD_BINARY=$out/lib/ld-*so.?
fi
# path to version-specific libraries, like libstdc++.so
LIBSTDCXX_SO_DIR=$(echo $out/lib/gcc/*/*)
# Move version-specific libraries out to avoid library mix when we
# upgrade gcc.
# TODO(trofi): update bootstrap tarball script and tarballs to put them
# into expected location directly.
LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/mv $out/lib/libstdc++.* $LIBSTDCXX_SO_DIR/
# On x86_64, ld-linux-x86-64.so.2 barfs on patchelf'ed programs. So
# use a copy of patchelf.
LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf .
# Older versions of the bootstrap-files did not compile their
# patchelf with -static-libgcc, so we have to be very careful not to
# run patchelf on the same copy of libgcc_s that it links against.
LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/lib/libgcc_s.so.1 .
LD_LIBRARY_PATH=.:$out/lib:$LIBSTDCXX_SO_DIR $LD_BINARY \
./patchelf --set-rpath $out/lib --force-rpath $out/lib/libgcc_s.so.1
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
if [ -L "$i" ]; then continue; fi
if [ -z "${i##*/liblto*}" ]; then continue; fi
echo patching "$i"
LD_LIBRARY_PATH=$out/lib:$LIBSTDCXX_SO_DIR $LD_BINARY \
./patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib:$LIBSTDCXX_SO_DIR --force-rpath "$i"
done
for i in $out/lib/librt-*.so $out/lib/libpcre*; do
if [ -L "$i" ]; then continue; fi
echo patching "$i"
$out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
done
export PATH=$out/bin
# Provide some additional symlinks.
ln -s bash $out/bin/sh
ln -s bzip2 $out/bin/bunzip2
# Provide a gunzip script.
cat > $out/bin/gunzip <<EOF
#!$out/bin/sh
exec $out/bin/gzip -d "\$@"
EOF
chmod +x $out/bin/gunzip
# Provide fgrep/egrep.
echo "#! $out/bin/sh" > $out/bin/egrep
echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
echo "#! $out/bin/sh" > $out/bin/fgrep
echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
# Provide xz (actually only xz -d will work).
echo "#! $out/bin/sh" > $out/bin/xz
echo "exec $builder unxz \"\$@\"" >> $out/bin/xz
chmod +x $out/bin/egrep $out/bin/fgrep $out/bin/xz

View File

@@ -0,0 +1,36 @@
{
system,
bootstrapFiles,
extraAttrs,
}:
derivation (
{
name = "bootstrap-tools";
builder = bootstrapFiles.busybox;
args = [
"ash"
"-e"
./musl/unpack-bootstrap-tools.sh
];
tarball = bootstrapFiles.bootstrapTools;
inherit system;
# Needed by the GCC wrapper.
langC = true;
langCC = true;
isGNU = true;
hardeningUnsupportedFlags = [
"fortify3"
"shadowstack"
"pacret"
"zerocallusedregs"
"trivialautovarinit"
];
}
// extraAttrs
)

View File

@@ -0,0 +1,64 @@
# Unpack the bootstrap tools tarball.
echo Unpacking the bootstrap tools...
$builder mkdir $out
< $tarball $builder unxz | $builder tar x -C $out
# Set the ELF interpreter / RPATH in the bootstrap binaries.
echo Patching the bootstrap tools...
if test -f $out/lib/ld.so.?; then
# MIPS case
LD_BINARY=$out/lib/ld.so.?
else
# i686, x86_64 and armv5tel
LD_BINARY=$out/lib/ld-*so.?
fi
# On x86_64, ld-linux-x86-64.so.2 barfs on patchelf'ed programs. So
# use a copy of patchelf.
LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf .
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
if [ -L "$i" ]; then continue; fi
if [ -z "${i##*/liblto*}" ]; then continue; fi
echo patching "$i"
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
./patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
done
for i in $out/lib/libpcre* $out/lib/libc.so; do
if [ -L "$i" ]; then continue; fi
echo patching "$i"
$out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
done
export PATH=$out/bin
# Fix the libc linker script.
#cat $out/lib/libc.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libc.so.tmp
#mv $out/lib/libc.so.tmp $out/lib/libc.so
#cat $out/lib/libpthread.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libpthread.so.tmp
#mv $out/lib/libpthread.so.tmp $out/lib/libpthread.so
# Provide some additional symlinks.
ln -s bash $out/bin/sh
ln -s bzip2 $out/bin/bunzip2
# Provide a gunzip script.
cat > $out/bin/gunzip <<EOF
#!$out/bin/sh
exec $out/bin/gzip -d "\$@"
EOF
chmod +x $out/bin/gunzip
# Provide fgrep/egrep.
echo "#! $out/bin/sh" > $out/bin/egrep
echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
echo "#! $out/bin/sh" > $out/bin/fgrep
echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
# Provide xz (actually only xz -d will work).
echo "#! $out/bin/sh" > $out/bin/xz
echo "exec $builder unxz \"\$@\"" >> $out/bin/xz
chmod +x $out/bin/egrep $out/bin/fgrep $out/bin/xz

View File

@@ -0,0 +1,951 @@
# This file constructs the standard build environment for the
# Linux platform. It's completely pure; that is, it relies on no
# external (non-Nix) tools, such as /usr/bin/gcc, and it contains a C
# compiler and linker that do not search in default locations,
# ensuring purity of components produced by it.
#
# It starts from prebuilt seed bootstrapFiles and creates a series of
# nixpkgs instances (stages) to gradually rebuild stdenv, which
# is used to build all other packages (including the bootstrapFiles).
#
# Goals of the bootstrap process:
# 1. final stdenv must not reference any of the bootstrap files.
# 2. final stdenv must not contain any of the bootstrap files.
# 3. final stdenv must not contain any of the files directly
# generated by the bootstrap code generators (assembler, linker,
# compiler).
#
# These goals ensure that final packages and final stdenv are built
# exclusively using nixpkgs package definitions and don't depend
# on bootstrapTools (via direct references, inclusion
# of copied code, or code compiled directly by bootstrapTools).
#
# Stages are described below along with their definitions.
#
# Debugging stdenv dependency graph:
# A useful tool to explore dependencies across stages is to use
# '__bootPackages' attribute of 'stdenv. Examples of last 3 stages:
# - stdenv
# - stdenv.__bootPackages.stdenv
# - stdenv.__bootPackages.stdenv.__bootPackages.stdenv
# - ... and so on.
#
# To explore build-time dependencies in graphical form one can use
# the following:
# $ nix-store --query --graph $(nix-instantiate -A stdenv) |
# grep -P -v '[.]sh|[.]patch|bash|[.]tar' | # avoid clutter
# dot -Tsvg > stdenv-final.svg
#
# To find all the packages built by a particular stdenv instance:
# $ for stage in 0 1 2 3 4; do
# echo "stage${stage} used in:"
# nix-store --query --graph $(nix-instantiate -A stdenv) |
# grep -P ".*bootstrap-stage${stage}-stdenv.*->.*" |
# sed 's/"[0-9a-z]\{32\}-/"/g'
# done
#
# To verify which stdenv was used to build a given final package:
# $ nix-store --query --graph $(nix-instantiate -A stdenv) |
# grep -P -v '[.]sh|[.]patch|bash|[.]tar' |
# grep -P '.*stdenv.*->.*glibc-2'
# "...-bootstrap-stage2-stdenv-linux.drv" -> "...-glibc-2.35-224.drv";
#
# For a TUI (rather than CLI) view, you can use:
#
# $ nix-tree --derivation $(nix-instantiate -A stdenv)
{
lib,
localSystem,
crossSystem,
config,
overlays,
crossOverlays ? [ ],
bootstrapFiles ?
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;
aarch64-linux = import ./bootstrap-files/aarch64-unknown-linux-gnu.nix;
mipsel-linux = import ./bootstrap-files/mipsel-unknown-linux-gnu.nix;
mips64el-linux = import (
if localSystem.isMips64n32 then
./bootstrap-files/mips64el-unknown-linux-gnuabin32.nix
else
./bootstrap-files/mips64el-unknown-linux-gnuabi64.nix
);
powerpc64-linux = import (
if localSystem.isAbiElfv2 then
./bootstrap-files/powerpc64-unknown-linux-gnuabielfv2.nix
else
./bootstrap-files/powerpc64-unknown-linux-gnuabielfv1.nix
);
powerpc64le-linux = import ./bootstrap-files/powerpc64le-unknown-linux-gnu.nix;
riscv64-linux = import ./bootstrap-files/riscv64-unknown-linux-gnu.nix;
s390x-linux = import ./bootstrap-files/s390x-unknown-linux-gnu.nix;
loongarch64-linux = import ./bootstrap-files/loongarch64-unknown-linux-gnu.nix;
};
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;
};
};
# Try to find an architecture compatible with our current system. We
# just try every bootstrap weve got and test to see if it is
# compatible with or current architecture.
getCompatibleTools = lib.foldl (
v: system:
if v != null then
v
else if localSystem.canExecute (lib.systems.elaborate { inherit system; }) then
archLookupTable.${system}
else
null
) null (lib.attrNames archLookupTable);
archLookupTable = table.${localSystem.libc} or (throw "unsupported libc for the pure Linux stdenv");
files =
archLookupTable.${localSystem.system} or (
if getCompatibleTools != null then
getCompatibleTools
else
(throw "unsupported platform for the pure Linux stdenv")
);
in
(config.replaceBootstrapFiles or lib.id) files,
}:
assert crossSystem == localSystem;
let
inherit (localSystem) system;
isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
isFromBootstrapFiles = pkg: pkg.passthru.isFromBootstrapFiles or false;
isBuiltByNixpkgsCompiler = pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
isBuiltByBootstrapFilesCompiler = pkg: isFromNixpkgs pkg && isFromBootstrapFiles pkg.stdenv.cc.cc;
commonGccOverrides = {
# Use a deterministically built compiler
# see https://github.com/NixOS/nixpkgs/issues/108475 for context
reproducibleBuild = true;
profiledCompiler = false;
# It appears that libcc1 (which is not a g++ plugin; it is a gdb plugin) gets linked against
# the libstdc++ from the compiler that *built* g++, not the libstdc++ which was just built.
# This causes a reference chain from stdenv to the bootstrapFiles:
#
# stdenv -> gcc-lib -> xgcc-lib -> bootstrapFiles
#
disableGdbPlugin = true;
};
commonPreHook = ''
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
'';
# The bootstrap process proceeds in several steps.
# 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;
};
# This function builds the various standard environments used during
# the bootstrap. In all stages, we build an stdenv and the package
# set that can be built with that stdenv.
stageFun =
prevStage:
{
name,
overrides ? (self: super: { }),
extraNativeBuildInputs ? [ ],
}:
let
thisStdenv = import ../generic {
name = "${name}-stdenv-linux";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config extraNativeBuildInputs;
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 ];
fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
inherit system;
inherit (config) rewriteURL;
};
cc =
if prevStage.gcc-unwrapped == null then
null
else
(lib.makeOverridable (import ../../build-support/cc-wrapper) {
name = "${name}-gcc-wrapper";
nativeTools = false;
nativeLibc = false;
expand-response-params = lib.optionalString (
prevStage.stdenv.hasCC or false && prevStage.stdenv.cc != "/dev/null"
) prevStage.expand-response-params;
cc = prevStage.gcc-unwrapped;
bintools = prevStage.binutils;
isGNU = true;
inherit (prevStage) libc;
inherit lib;
inherit (prevStage) coreutils gnugrep;
stdenvNoCC = prevStage.ccWrapperStdenv;
fortify-headers = prevStage.fortify-headers;
runtimeShell = prevStage.ccWrapperStdenv.shell;
}).overrideAttrs
(
a:
lib.optionalAttrs (prevStage.gcc-unwrapped.passthru.isXgcc or false) {
# This affects only `xgcc` (the compiler which compiles the final compiler).
postFixup = (a.postFixup or "") + ''
echo "--sysroot=${lib.getDev prevStage.libc}" >> $out/nix-support/cc-cflags
'';
}
);
overrides = self: super: (overrides self super) // { fetchurl = thisStdenv.fetchurlBoot; };
};
in
{
inherit config overlays;
stdenv = thisStdenv;
};
in
assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
[
(
{ }:
{
__raw = true;
gcc-unwrapped = null;
binutils = null;
coreutils = null;
gnugrep = null;
}
)
# 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;
};
}
)
# Create the first "real" standard environment. This one consists
# of bootstrap tools only, and a minimal Glibc to keep the GCC
# configure script happy.
#
# For clarity, we only use the previous stage when specifying these
# stages. So stageN should only ever have references for stage{N-1}.
#
# If we ever need to use a package from more than one stage back, we
# simply re-export those packages in the middle stage(s) using the
# overrides attribute and the inherit syntax.
(
prevStage:
# previous stage0 stdenv:
assert isFromBootstrapFiles prevStage.binutils.bintools;
assert isFromBootstrapFiles prevStage."${localSystem.libc}";
assert isFromBootstrapFiles prevStage.libc;
assert isFromBootstrapFiles prevStage.gcc-unwrapped;
assert isFromBootstrapFiles prevStage.coreutils;
assert isFromBootstrapFiles prevStage.gnugrep;
stageFun prevStage {
name = "bootstrap-stage1";
# Rebuild binutils to use from stage2 onwards.
overrides = self: super: {
binutils-unwrapped = super.binutils-unwrapped.override {
enableGold = false;
};
inherit (prevStage)
ccWrapperStdenv
gcc-unwrapped
coreutils
gnugrep
binutils
;
${localSystem.libc} = prevStage.${localSystem.libc};
# A threaded perl build needs glibc/libpthread_nonshared.a,
# which is not included in bootstrapTools, so disable threading.
# 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;
};
# Let gettext "checking for working iconv" success without trying
# to convert between UTF-8 and EUC-JP which doesn't work here
# because of missing locale and gconv, same for libunistring below
gettext = super.gettext.overrideAttrs (attrs: {
env = attrs.env or { } // {
am_cv_func_iconv_works = "yes";
};
});
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
# First rebuild of gcc; this is linked against all sorts of junk
# from the bootstrap-files, but we only care about the code that
# this compiler *emits*. The `gcc` binary produced in this stage
# is not part of the final stdenv.
(
prevStage:
assert isBuiltByBootstrapFilesCompiler prevStage.binutils-unwrapped;
assert isFromBootstrapFiles prevStage."${localSystem.libc}";
assert isFromBootstrapFiles prevStage.libc;
assert isFromBootstrapFiles prevStage.gcc-unwrapped;
assert isFromBootstrapFiles prevStage.coreutils;
assert isFromBootstrapFiles prevStage.gnugrep;
assert isBuiltByBootstrapFilesCompiler prevStage.patchelf;
stageFun prevStage {
name = "bootstrap-stage-xgcc";
overrides = self: super: {
inherit (prevStage)
ccWrapperStdenv
coreutils
gnugrep
gettext
bison
texinfo
zlib
gnum4
perl
patchelf
;
${localSystem.libc} = prevStage.${localSystem.libc};
gmp = super.gmp.override { cxx = false; };
# This stage also rebuilds binutils which will of course be used only in the next stage.
# We inherit this until stage3, in stage4 it will be rebuilt using the adjacent bash/runtimeShell pkg.
# TODO(@sternenseemann): Can we already build the wrapper with the actual runtimeShell here?
# 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";
};
gcc-unwrapped =
(super.gcc-unwrapped.override (
commonGccOverrides
// {
# The most logical name for this package would be something like
# "gcc-stage1". Unfortunately "stage" is already reserved for the
# layers of stdenv, so using "stage" in the name of this package
# would cause massive confusion.
#
# Gcc calls its "stage1" compiler `xgcc` (--disable-bootstrap results
# in `xgcc` being copied to $prefix/bin/gcc). So we imitate that.
#
name = "xgcc";
# xgcc uses ld linked against nixpkgs' glibc and gcc built
# against bootstrapTools glibc. We can't allow loading
# $out/libexec/gcc/x86_64-unknown-linux-gnu/13.0.1/liblto_plugin.so
# to mix libc.so:
# ...-binutils-patchelfed-ld-2.40/bin/ld: ...-xgcc-13.0.0/libexec/gcc/x86_64-unknown-linux-gnu/13.0.1/liblto_plugin.so:
# error loading plugin: ...-bootstrap-tools/lib/libpthread.so.0: undefined symbol: __libc_vfork, version GLIBC_PRIVATE
enableLTO = false;
# relocatable libs may not be available in the bootstrap
# which will cause compilation to fail with
# configure: error: C compiler cannot create executables
enableDefaultPie = false;
}
)).overrideAttrs
(a: {
# This signals to cc-wrapper (as overridden above in this file) to add `--sysroot`
# to `$out/nix-support/cc-cflags`.
passthru = a.passthru // {
isXgcc = true;
};
# Gcc will look for the C library headers in
#
# ${with_build_sysroot}${native_system_header_dir}
#
# The ordinary gcc expression sets `--with-build-sysroot=/` and sets
# `native-system-header-dir` to `"${lib.getDev stdenv.cc.libc}/include`.
#
# Unfortunately the value of "--with-native-system-header-dir=" gets "burned in" to the
# compiler, and it is quite difficult to get the compiler to change or ignore it
# afterwards. On the other hand, the `sysroot` is very easy to change; you can just pass
# a `--sysroot` flag to `gcc`.
#
# So we override the expression to remove the default settings for these flags, and
# replace them such that the concatenated value will be the same as before, but we split
# the value between the two variables differently: `--native-system-header-dir=/include`,
# and `--with-build-sysroot=${lib.getDev stdenv.cc.libc}`.
#
configureFlags = (a.configureFlags or [ ]) ++ [
"--with-native-system-header-dir=/include"
"--with-build-sysroot=${lib.getDev self.stdenv.cc.libc}"
# Don't assume that `gettext` was built with iconv support, since we don't have
# our own `glibc` yet.
"--disable-nls"
];
# This is a separate phase because gcc assembles its phase scripts
# in bash instead of nix (we should fix that).
preFixupPhases = (a.preFixupPhases or [ ]) ++ [ "preFixupXgccPhase" ];
# This is needed to prevent "error: cycle detected in build of '...-xgcc-....drv'
# in the references of output 'lib' from output 'out'"
preFixupXgccPhase = ''
find $lib/lib/ -name \*.so\* -exec patchelf --shrink-rpath {} \; || true
'';
});
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
# 2nd stdenv that contains our own rebuilt binutils and is used for
# compiling our own Glibc.
#
(
prevStage:
# previous stage1 stdenv:
assert isBuiltByBootstrapFilesCompiler prevStage.binutils-unwrapped;
assert isFromBootstrapFiles prevStage."${localSystem.libc}";
assert isFromBootstrapFiles prevStage.libc;
assert isBuiltByBootstrapFilesCompiler prevStage.gcc-unwrapped;
assert isFromBootstrapFiles prevStage.coreutils;
assert isFromBootstrapFiles prevStage.gnugrep;
assert isBuiltByBootstrapFilesCompiler prevStage.patchelf;
stageFun prevStage {
name = "bootstrap-stage2";
overrides = self: super: {
inherit (prevStage)
ccWrapperStdenv
gettext
gcc-unwrapped
coreutils
gnugrep
perl
gnum4
bison
texinfo
which
;
dejagnu = super.dejagnu.overrideAttrs (a: {
doCheck = false;
});
# Avoids infinite recursion, as this is in the build-time dependencies of libc.
libiconv = self.libcIconv prevStage.libc;
# We need libidn2 and its dependency libunistring as glibc dependency.
# To avoid the cycle, we build against bootstrap libc, nuke references,
# and use the result as input for our final glibc. We also pass this pair
# through, so the final package-set uses exactly the same builds.
libunistring = super.libunistring.overrideAttrs (attrs: {
postFixup = attrs.postFixup or "" + ''
${self.nukeReferences}/bin/nuke-refs "$out"/lib/lib*.so.*.*
'';
# Apparently iconv won't work with bootstrap glibc, but it will be used
# with glibc built later where we keep *this* build of libunistring,
# so we need to trick it into supporting libiconv.
env = attrs.env or { } // {
am_cv_func_iconv_works = "yes";
};
});
libidn2 = super.libidn2.overrideAttrs (attrs: {
postFixup = attrs.postFixup or "" + ''
${self.nukeReferences}/bin/nuke-refs -e '${lib.getLib self.libunistring}' \
"$out"/lib/lib*.so.*.*
'';
});
# This also contains the full, dynamically linked, final Glibc.
binutils = prevStage.binutils.override {
# Rewrap the binutils with the new glibc, so both the next
# stage's wrappers use it.
inherit (self) libc;
# Unfortunately, when building gcc in the next stage, its LTO plugin
# would use the final libc but `ld` would use the bootstrap one,
# and that can fail to load. Therefore we upgrade `ld` to use newer libc;
# apparently the interpreter needs to match libc, too.
bintools = self.stdenvNoCC.mkDerivation {
pname = prevStage.bintools.bintools.pname + "-patchelfed-ld";
inherit (prevStage.bintools.bintools) version;
passthru = { inherit (prevStage.bintools.passthru) isFromBootstrapFiles; };
enableParallelBuilding = true;
dontUnpack = true;
dontBuild = true;
strictDeps = true;
# We wouldn't need to *copy* all, but it's easier and the result is temporary anyway.
installPhase = ''
mkdir -p "$out"/bin
cp -a '${prevStage.bintools.bintools}'/bin/* "$out"/bin/
chmod +w "$out"/bin/ld.bfd
patchelf --set-interpreter '${self.libc}'/lib/ld*.so.? \
--set-rpath "${self.libc}/lib:$(patchelf --print-rpath "$out"/bin/ld.bfd)" \
"$out"/bin/ld.bfd
'';
};
};
# TODO(amjoseph): It is not yet entirely clear why this is necessary.
# Something strange is going on with xgcc and libstdc++ on pkgsMusl.
patchelf = super.patchelf.overrideAttrs (
previousAttrs:
lib.optionalAttrs super.stdenv.hostPlatform.isMusl {
NIX_CFLAGS_COMPILE = (previousAttrs.NIX_CFLAGS_COMPILE or "") + " -static-libstdc++";
}
);
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
# `libtool` comes with obsolete config.sub/config.guess that don't recognize Risc-V.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
# Construct a third stdenv identical to the 2nd, except that this
# one uses the rebuilt Glibc from stage2. It still uses the recent
# binutils and rest of the bootstrap tools, including GCC.
(
prevStage:
# previous stage2 stdenv:
assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
assert isBuiltByNixpkgsCompiler prevStage.${localSystem.libc};
assert isBuiltByNixpkgsCompiler prevStage.libc;
assert isBuiltByBootstrapFilesCompiler prevStage.gcc-unwrapped;
assert isFromBootstrapFiles prevStage.coreutils;
assert isFromBootstrapFiles prevStage.gnugrep;
assert isBuiltByNixpkgsCompiler prevStage.patchelf;
assert lib.all isBuiltByNixpkgsCompiler [
prevStage.gmp
prevStage.isl_0_20
prevStage.libmpc
prevStage.mpfr
];
stageFun prevStage {
name = "bootstrap-stage3";
overrides =
self: super:
{
inherit (prevStage)
ccWrapperStdenv
binutils
coreutils
gnugrep
perl
patchelf
linuxHeaders
gnum4
bison
libidn2
libunistring
libxcrypt
;
# We build a special copy of libgmp which doesn't use libstdc++, because
# xgcc++'s libstdc++ references the bootstrap-files (which is what
# compiles xgcc++).
gmp = super.gmp.override { cxx = false; };
}
// {
${localSystem.libc} = prevStage.${localSystem.libc};
gcc-unwrapped =
(super.gcc-unwrapped.override (
commonGccOverrides
// {
inherit (prevStage) which;
}
)).overrideAttrs
(a: {
# so we can add them to allowedRequisites below
passthru = a.passthru // {
inherit (self)
gmp
mpfr
libmpc
isl
;
};
});
};
extraNativeBuildInputs = [
prevStage.patchelf
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
prevStage.updateAutotoolsGnuConfigScriptsHook
];
}
)
# Construct a fourth stdenv that uses the new GCC. But coreutils is
# still from the bootstrap tools.
#
(
prevStage:
# previous stage3 stdenv:
assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
assert isBuiltByNixpkgsCompiler prevStage.${localSystem.libc};
assert isBuiltByNixpkgsCompiler prevStage.libc;
assert isBuiltByNixpkgsCompiler prevStage.gcc-unwrapped;
assert isFromBootstrapFiles prevStage.coreutils;
assert isFromBootstrapFiles prevStage.gnugrep;
assert isBuiltByNixpkgsCompiler prevStage.patchelf;
stageFun prevStage {
name = "bootstrap-stage4";
overrides = self: super: {
# Zlib has to be inherited and not rebuilt in this stage,
# because gcc (since JAR support) already depends on zlib, and
# then if we already have a zlib we want to use that for the
# other purposes (binutils and top-level pkgs) too.
inherit (prevStage)
gettext
gnum4
bison
perl
texinfo
zlib
linuxHeaders
libidn2
libunistring
;
${localSystem.libc} = prevStage.${localSystem.libc};
# Since this is the first fresh build of binutils since stage2, our own runtimeShell will be used.
binutils = super.binutils.override {
# Build expand-response-params with last stage like below
inherit (prevStage) expand-response-params;
};
# To allow users' overrides inhibit dependencies too heavy for
# bootstrap, like guile: https://github.com/NixOS/nixpkgs/issues/181188
gnumake = super.gnumake.override { inBootstrap = true; };
gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) {
nativeTools = false;
nativeLibc = false;
isGNU = true;
inherit (prevStage) expand-response-params;
cc = prevStage.gcc-unwrapped;
bintools = self.binutils;
inherit lib;
inherit (self)
stdenvNoCC
coreutils
gnugrep
runtimeShell
libc
;
fortify-headers = self.fortify-headers;
};
};
extraNativeBuildInputs = [
prevStage.patchelf
prevStage.xz
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
prevStage.updateAutotoolsGnuConfigScriptsHook
];
}
)
# Construct the final stdenv. It uses the Glibc and GCC, and adds
# in a new binutils that doesn't depend on bootstrap-tools, as well
# as dynamically linked versions of all other tools.
#
# When updating stdenvLinux, make sure that the result has no
# dependency (`nix-store -qR') on bootstrapTools or the first
# binutils built.
#
(
prevStage:
# previous stage4 stdenv; see stage3 comment regarding gcc,
# which applies here as well.
assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
assert isBuiltByNixpkgsCompiler prevStage.${localSystem.libc};
assert isBuiltByNixpkgsCompiler prevStage.libc;
assert isBuiltByNixpkgsCompiler prevStage.gcc-unwrapped;
assert isBuiltByNixpkgsCompiler prevStage.coreutils;
assert isBuiltByNixpkgsCompiler prevStage.gnugrep;
assert isBuiltByNixpkgsCompiler prevStage.patchelf;
{
inherit config overlays;
stdenv = import ../generic rec {
name = "stdenv-linux";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config;
preHook = commonPreHook;
initialPath = ((import ../generic/common-path.nix) { pkgs = prevStage; });
extraNativeBuildInputs = [
prevStage.patchelf
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
prevStage.updateAutotoolsGnuConfigScriptsHook
];
cc = prevStage.gcc;
shell = cc.shell;
inherit (prevStage.stdenv) fetchurlBoot;
extraAttrs = {
inherit bootstrapTools;
shellPackage = prevStage.bash;
};
disallowedRequisites = [ bootstrapTools.out ];
# Mainly avoid reference to bootstrap tools
allowedRequisites =
let
inherit (prevStage)
gzip
bzip2
xz
zlib
bashNonInteractive
binutils
coreutils
diffutils
findutils
gawk
gmp
gnumake
gnused
gnutar
gnugrep
gnupatch
patchelf
ed
file
glibc
attr
acl
libidn2
libunistring
linuxHeaders
gcc
fortify-headers
gcc-unwrapped
;
in
# Simple executable tools
lib.concatMap
(p: [
(lib.getBin p)
(lib.getLib p)
])
[
gzip
bzip2
xz
bashNonInteractive
binutils.bintools
coreutils
diffutils
findutils
gawk
gmp
gnumake
gnused
gnutar
gnugrep
gnupatch
patchelf
ed
file
]
# Library dependencies
++ map lib.getLib [
attr
acl
zlib
gnugrep.pcre2
libidn2
libunistring
]
# More complicated cases
++ (map (x: lib.getOutput x (prevStage.libc)) [
"out"
"dev"
"bin"
])
++ [
linuxHeaders # propagated from .dev
binutils
gcc
gcc.cc
gcc.cc.lib
gcc.expand-response-params # != (prevStage.)expand-response-params
gcc.cc.libgcc
glibc.passthru.libgcc
]
++ lib.optionals (localSystem.libc == "musl") [ fortify-headers ]
++ [
prevStage.updateAutotoolsGnuConfigScriptsHook
prevStage.gnu-config
]
++ [
gcc-unwrapped.gmp
gcc-unwrapped.libmpc
gcc-unwrapped.mpfr
gcc-unwrapped.isl
];
overrides =
self: super:
{
inherit (prevStage)
gzip
bzip2
xz
bashNonInteractive
coreutils
diffutils
findutils
gawk
gnused
gnutar
gnugrep
gnupatch
patchelf
attr
acl
zlib
libunistring
;
inherit (prevStage.gnugrep) pcre2;
${localSystem.libc} = prevStage.${localSystem.libc};
# Hack: avoid libidn2.{bin,dev} referencing bootstrap tools. There's a logical cycle.
libidn2 = import ../../development/libraries/libidn2/no-bootstrap-reference.nix {
inherit lib;
inherit (prevStage) libidn2;
inherit (self)
stdenv
runCommandLocal
patchelf
libunistring
;
};
gnumake = super.gnumake.override { inBootstrap = false; };
}
// lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
# Need to get rid of these when cross-compiling.
inherit (prevStage) binutils binutils-unwrapped;
gcc = cc;
};
};
}
)
# This "no-op" stage is just a place to put the assertions about stage5.
(
prevStage:
# previous stage5 stdenv; see stage3 comment regarding gcc,
# which applies here as well.
assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
assert isBuiltByNixpkgsCompiler prevStage.${localSystem.libc};
assert isBuiltByNixpkgsCompiler prevStage.libc;
assert isBuiltByNixpkgsCompiler prevStage.gcc-unwrapped;
assert isBuiltByNixpkgsCompiler prevStage.coreutils;
assert isBuiltByNixpkgsCompiler prevStage.gnugrep;
assert isBuiltByNixpkgsCompiler prevStage.patchelf;
{
inherit (prevStage) config overlays stdenv;
}
)
]

View File

@@ -0,0 +1,48 @@
{
system ? builtins.currentSystem,
}:
let
inherit (releaseLib) lib;
releaseLib = import ../../top-level/release-lib.nix {
# We're not using any functions from release-lib.nix that look at
# supportedSystems.
supportedSystems = [ ];
};
make =
crossSystem:
import ./make-bootstrap-tools.nix {
pkgs = releaseLib.pkgsForCross crossSystem system;
};
in
lib.mapAttrs (n: make) (
with lib.systems.examples;
{
# NOTE: Only add platforms for which there are files in `./bootstrap-files`
# or for which you plan to request the tarball upload soon. See the
# maintainers/scripts/bootstrap-files/README.md
# on how to request an upload.
# Sort following the sorting in `./default.nix` `bootstrapFiles` argument.
armv5tel-unknown-linux-gnueabi = sheevaplug;
armv6l-unknown-linux-gnueabihf = raspberryPi;
armv7l-unknown-linux-gnueabihf = armv7l-hf-multiplatform;
aarch64-unknown-linux-gnu = aarch64-multiplatform;
mipsel-unknown-linux-gnu = mipsel-linux-gnu;
mips64el-unknown-linux-gnuabin32 = mips64el-linux-gnuabin32;
mips64el-unknown-linux-gnuabi64 = mips64el-linux-gnuabi64;
powerpc64-unknown-linux-gnuabielfv1 = ppc64-elfv1;
powerpc64-unknown-linux-gnuabielfv2 = ppc64-elfv2;
powerpc64le-unknown-linux-gnu = powernv;
riscv64-unknown-linux-gnu = riscv64;
s390x-unknown-linux-gnu = s390x;
loongarch64-unknown-linux-gnu = loongarch64-linux;
# musl
aarch64-unknown-linux-musl = aarch64-multiplatform-musl;
armv6l-unknown-linux-musleabihf = muslpi;
riscv64-unknown-linux-musl = riscv64-musl;
x86_64-unknown-linux-musl = musl64;
}
)

View File

@@ -0,0 +1,98 @@
{
pkgs ? import ../../.. { },
}:
let
inherit (pkgs)
lib
stdenv
config
libc
;
patchelf = pkgs.patchelf.overrideAttrs (previousAttrs: {
NIX_CFLAGS_COMPILE = (previousAttrs.NIX_CFLAGS_COMPILE or [ ]) ++ [
"-static-libgcc"
"-static-libstdc++"
];
NIX_CFLAGS_LINK = (previousAttrs.NIX_CFLAGS_LINK or [ ]) ++ [
"-static-libgcc"
"-static-libstdc++"
];
});
in
rec {
coreutilsMinimal = pkgs.coreutils.override (args: {
# We want coreutils without ACL/attr support.
aclSupport = false;
attrSupport = false;
# Our tooling currently can't handle scripts in bin/, only ELFs and symlinks.
singleBinary = "symlinks";
});
tarMinimal = pkgs.gnutar.override { acl = null; };
busyboxMinimal = pkgs.busybox.override {
useMusl = lib.meta.availableOn stdenv.hostPlatform pkgs.musl;
enableStatic = true;
enableMinimal = true;
extraConfig = ''
CONFIG_ASH y
CONFIG_ASH_ECHO y
CONFIG_ASH_TEST y
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
CONFIG_MKDIR y
CONFIG_TAR y
CONFIG_UNXZ y
'';
};
bootGCC =
(pkgs.gcc.cc.override {
enableLTO = false;
isl = null;
}).overrideAttrs
(old: {
patches = old.patches or [ ] ++ [
(pkgs.fetchpatch {
# c++tools: Don't check --enable-default-pie.
# --enable-default-pie breaks bootstrap gcc otherwise, because libiberty.a is not found
url = "https://github.com/gcc-mirror/gcc/commit/3f1f99ef82a65d66e3aaa429bf4fb746b93da0db.patch";
hash = "sha256-wKVuwrW22gSN1woYFYxsyVk49oYmbogIN6FWbU8cVds=";
})
];
});
bootBinutils = pkgs.binutils.bintools.override {
withAllTargets = false;
# Don't need two linkers, disable whatever's not primary/default.
enableGold = false;
# bootstrap is easier w/static
enableShared = false;
};
build = pkgs.callPackage ./stdenv-bootstrap-tools.nix {
inherit
bootBinutils
coreutilsMinimal
tarMinimal
busyboxMinimal
bootGCC
libc
patchelf
;
};
inherit (build) bootstrapFiles;
bootstrapTools = import ./bootstrap-tools {
inherit (stdenv.buildPlatform) system; # Used to determine where to build
inherit (stdenv.hostPlatform) libc;
inherit lib bootstrapFiles config;
};
test = pkgs.callPackage ./test-bootstrap-tools.nix {
inherit bootstrapTools;
inherit (bootstrapFiles) busybox;
};
}

View File

@@ -0,0 +1,218 @@
{
lib,
stdenv,
bashNonInteractive,
binutils,
bootBinutils,
bootGCC,
buildPackages,
busyboxMinimal,
bzip2,
coreutilsMinimal,
diffutils,
findutils,
gawk,
gmpxx,
gnugrep,
gnumake,
gnused,
gzip,
libc,
libmpc,
mpfr,
patch,
patchelf,
runCommand,
tarMinimal,
zlib,
}:
let
# ${libc.src}/sysdeps/unix/sysv/linux/loongarch/lp64/libnsl.abilist does not exist!
withLibnsl = !stdenv.hostPlatform.isLoongArch64;
in
stdenv.mkDerivation (finalAttrs: {
name = "stdenv-bootstrap-tools";
meta = {
# Increase priority to unblock nixpkgs-unstable
# https://github.com/NixOS/nixpkgs/pull/104679#issuecomment-732267288
schedulingPriority = 200;
};
nativeBuildInputs = [
buildPackages.nukeReferences
buildPackages.cpio
];
buildCommand = ''
set -x
mkdir -p $out/bin $out/lib $out/libexec
''
+ (
if (stdenv.hostPlatform.libc == "glibc") then
''
# Copy what we need of Glibc.
cp -d ${libc.out}/lib/ld*.so* $out/lib
cp -d ${libc.out}/lib/libc*.so* $out/lib
cp -d ${libc.out}/lib/libc_nonshared.a $out/lib
cp -d ${libc.out}/lib/libm*.so* $out/lib
cp -d ${libc.out}/lib/libdl*.so* $out/lib
cp -d ${libc.out}/lib/librt*.so* $out/lib
cp -d ${libc.out}/lib/libpthread*.so* $out/lib
''
+ lib.optionalString withLibnsl ''
cp -d ${libc.out}/lib/libnsl*.so* $out/lib
''
+ ''
cp -d ${libc.out}/lib/libnss*.so* $out/lib
cp -d ${libc.out}/lib/libresolv*.so* $out/lib
# Copy all runtime files to enable non-PIE, PIE, static PIE and profile-generated builds
cp -d ${libc.out}/lib/*.o $out/lib
# Hacky compat with our current unpack-bootstrap-tools.sh
ln -s librt.so "$out"/lib/librt-dummy.so
cp -rL ${libc.dev}/include $out
chmod -R u+w "$out"
# libc can contain linker scripts: find them, copy their deps,
# and get rid of absolute paths (nuke-refs would make them useless)
local lScripts=$(grep --files-with-matches --max-count=1 'GNU ld script' -R "$out/lib")
cp -d -t "$out/lib/" $(cat $lScripts | tr " " "\n" | grep -F '${libc.out}' | sort -u)
for f in $lScripts; do
substituteInPlace "$f" --replace '${libc.out}/lib/' ""
done
# Hopefully we won't need these.
rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
find $out/include -name .install -exec rm {} \;
find $out/include -name ..install.cmd -exec rm {} \;
mv $out/include $out/include-glibc
''
else if (stdenv.hostPlatform.libc == "musl") then
''
# Copy what we need from musl
cp ${libc.out}/lib/* $out/lib
cp -rL ${libc.dev}/include $out
chmod -R u+w "$out"
rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
find $out/include -name .install -exec rm {} \;
find $out/include -name ..install.cmd -exec rm {} \;
mv $out/include $out/include-libc
''
else
throw "unsupported libc for bootstrap tools"
)
+ ''
# Copy coreutils, bash, etc.
cp -d ${coreutilsMinimal.out}/bin/* $out/bin
(cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
cp ${bashNonInteractive.out}/bin/bash $out/bin
cp ${findutils.out}/bin/find $out/bin
cp ${findutils.out}/bin/xargs $out/bin
cp -d ${diffutils.out}/bin/* $out/bin
cp -d ${gnused.out}/bin/* $out/bin
cp -d ${gnugrep.out}/bin/grep $out/bin
cp ${gawk.out}/bin/gawk $out/bin
cp -d ${gawk.out}/bin/awk $out/bin
cp ${tarMinimal.out}/bin/tar $out/bin
cp ${gzip.out}/bin/.gzip-wrapped $out/bin/gzip
cp ${bzip2.bin}/bin/bzip2 $out/bin
cp -d ${gnumake.out}/bin/* $out/bin
cp -d ${patch}/bin/* $out/bin
cp ${patchelf}/bin/* $out/bin
cp -d ${gnugrep.pcre2.out}/lib/libpcre2*.so* $out/lib # needed by grep
# Copy what we need of GCC.
cp -d ${bootGCC.out}/bin/gcc $out/bin
cp -d ${bootGCC.out}/bin/cpp $out/bin
cp -d ${bootGCC.out}/bin/g++ $out/bin
cp ${bootGCC.lib}/lib/libgcc_s.so* $out/lib
cp -d ${bootGCC.lib}/lib/libstdc++.so* $out/lib
cp -d ${bootGCC.out}/lib/libssp.a* $out/lib
cp -d ${bootGCC.out}/lib/libssp_nonshared.a $out/lib
cp -rd ${bootGCC.out}/lib/gcc $out/lib
chmod -R u+w $out/lib
rm -f $out/lib/gcc/*/*/include*/linux
rm -f $out/lib/gcc/*/*/include*/sound
rm -rf $out/lib/gcc/*/*/include*/root
rm -f $out/lib/gcc/*/*/include-fixed/asm
rm -rf $out/lib/gcc/*/*/plugin
#rm -f $out/lib/gcc/*/*/*.a
cp -rd ${bootGCC.out}/libexec/* $out/libexec
chmod -R u+w $out/libexec
rm -rf $out/libexec/gcc/*/*/plugin
mkdir -p $out/include
cp -rd ${bootGCC.out}/include/c++ $out/include
chmod -R u+w $out/include
rm -rf $out/include/c++/*/ext/pb_ds
rm -rf $out/include/c++/*/ext/parallel
cp -d ${gmpxx.out}/lib/libgmp*.so* $out/lib
cp -d ${mpfr.out}/lib/libmpfr*.so* $out/lib
cp -d ${libmpc.out}/lib/libmpc*.so* $out/lib
cp -d ${zlib.out}/lib/libz.so* $out/lib
''
+ lib.optionalString (stdenv.hostPlatform.isRiscV) ''
# libatomic is required on RiscV platform for C/C++ atomics and pthread
# even though they may be translated into native instructions.
cp -d ${bootGCC.out}/lib/libatomic.a* $out/lib
''
+ ''
cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
# Copy binutils.
for i in as ld ar ranlib nm strip readelf objdump; do
cp ${bootBinutils.out}/bin/$i $out/bin
done
cp -r '${lib.getLib binutils.bintools}'/lib/* "$out/lib/"
chmod -R u+w $out
# Strip executables even further.
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
if test -x $i -a ! -L $i; then
chmod +w $i
$STRIP -s $i || true
fi
done
nuke-refs $out/bin/*
nuke-refs $out/lib/*
nuke-refs $out/lib/*/*
nuke-refs $out/libexec/gcc/*/*/*
nuke-refs $out/lib/gcc/*/*/*
nuke-refs $out/lib/gcc/*/*/include-fixed/*{,/*}
mkdir $out/.pack
mv $out/* $out/.pack
mv $out/.pack $out/pack
mkdir $out/on-server
XZ_OPT="-9 -e" tar cvJf $out/on-server/bootstrap-tools.tar.xz --hard-dereference --sort=name --numeric-owner --owner=0 --group=0 --mtime=@1 -C $out/pack .
cp ${busyboxMinimal}/bin/busybox $out/on-server
chmod u+w $out/on-server/busybox
nuke-refs $out/on-server/busybox
''; # */
# The result should not contain any references (store paths) so
# that we can safely copy them out of the store and to other
# locations in the store.
allowedReferences = [ ];
passthru = {
bootstrapFiles = {
# Make them their own store paths to test that busybox still works when the binary is named /nix/store/HASH-busybox
busybox = runCommand "busybox" { } "cp ${finalAttrs.finalPackage}/on-server/busybox $out";
bootstrapTools =
runCommand "bootstrap-tools.tar.xz" { }
"cp ${finalAttrs.finalPackage}/on-server/bootstrap-tools.tar.xz $out";
};
};
})

View File

@@ -0,0 +1,70 @@
{
lib,
stdenv,
binutils,
busybox,
bootstrapTools,
hello,
}:
derivation {
name = "test-bootstrap-tools";
inherit (stdenv.hostPlatform) system; # We cannot "cross test"
builder = busybox;
args = [
"ash"
"-e"
"-c"
"eval \"$buildCommand\""
];
buildCommand = ''
export PATH=${bootstrapTools}/bin
ls -l
mkdir $out
mkdir $out/bin
sed --version
find --version
diff --version
patch --version
make --version
awk --version
grep --version
gcc --version
''
+ lib.optionalString (stdenv.hostPlatform.libc == "glibc") ''
rtld=$(echo ${bootstrapTools}/lib/${builtins.unsafeDiscardStringContext # only basename
(baseNameOf binutils.dynamicLinker)})
libc_includes=${bootstrapTools}/include-glibc
''
+ lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
rtld=$(echo ${bootstrapTools}/lib/ld-musl*.so.?)
libc_includes=${bootstrapTools}/include-libc
''
+ ''
# path to version-specific libraries, like libstdc++.so
cxx_libs=$(echo ${bootstrapTools}/lib/gcc/*/*)
export CPP="cpp -idirafter $libc_includes -B${bootstrapTools}"
export CC="gcc -idirafter $libc_includes -B${bootstrapTools} -Wl,-dynamic-linker,$rtld -Wl,-rpath,${bootstrapTools}/lib -Wl,-rpath,$cxx_libs"
export CXX="g++ -idirafter $libc_includes -B${bootstrapTools} -Wl,-dynamic-linker,$rtld -Wl,-rpath,${bootstrapTools}/lib -Wl,-rpath,$cxx_libs"
echo '#include <stdio.h>' >> foo.c
echo '#include <limits.h>' >> foo.c
echo 'int main() { printf("Hello World\\n"); return 0; }' >> foo.c
$CC -o $out/bin/foo foo.c
$out/bin/foo
echo '#include <iostream>' >> bar.cc
echo 'int main() { std::cout << "Hello World\\n"; }' >> bar.cc
$CXX -v -o $out/bin/bar bar.cc
$out/bin/bar
tar xvf ${hello.src}
cd hello-*
./configure --prefix=$out
make
make install
'';
}