From 052ecdbfaebcaf63dcad2b43c7b97991906a01bb Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Sat, 27 Jul 2024 19:44:59 -0700 Subject: [PATCH] freshBootstrapTools: unify glibc and musl into the same directory CI required that I `nixfmt` them at the same time. --- .../linux/bootstrap-tools-musl/default.nix | 19 ---------- pkgs/stdenv/linux/bootstrap-tools/default.nix | 24 ------------- pkgs/stdenv/linux/bootstrap-tools/glibc.nix | 35 +++++++++++++++++++ .../unpack-bootstrap-tools.sh | 0 pkgs/stdenv/linux/bootstrap-tools/musl.nix | 34 ++++++++++++++++++ .../musl}/unpack-bootstrap-tools.sh | 0 pkgs/stdenv/linux/default.nix | 2 +- pkgs/stdenv/linux/make-bootstrap-tools.nix | 4 +-- 8 files changed, 72 insertions(+), 46 deletions(-) delete mode 100644 pkgs/stdenv/linux/bootstrap-tools-musl/default.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-tools/default.nix create mode 100644 pkgs/stdenv/linux/bootstrap-tools/glibc.nix rename pkgs/stdenv/linux/bootstrap-tools/{scripts => glibc}/unpack-bootstrap-tools.sh (100%) create mode 100644 pkgs/stdenv/linux/bootstrap-tools/musl.nix rename pkgs/stdenv/linux/{bootstrap-tools-musl/scripts => bootstrap-tools/musl}/unpack-bootstrap-tools.sh (100%) diff --git a/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix b/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix deleted file mode 100644 index 6d2490acfa47..000000000000 --- a/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ system, bootstrapFiles, extraAttrs }: - -derivation ({ - name = "bootstrap-tools"; - - builder = bootstrapFiles.busybox; - - args = [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ]; - - tarball = bootstrapFiles.bootstrapTools; - - inherit system; - - # Needed by the GCC wrapper. - langC = true; - langCC = true; - isGNU = true; - hardeningUnsupportedFlags = [ "fortify3" "zerocallusedregs" "trivialautovarinit" ]; -} // extraAttrs) diff --git a/pkgs/stdenv/linux/bootstrap-tools/default.nix b/pkgs/stdenv/linux/bootstrap-tools/default.nix deleted file mode 100644 index 4450679983ff..000000000000 --- a/pkgs/stdenv/linux/bootstrap-tools/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ system, bootstrapFiles, extraAttrs }: - -derivation ({ - name = "bootstrap-tools"; - - builder = bootstrapFiles.busybox; - - args = [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ]; - - tarball = bootstrapFiles.bootstrapTools; - - inherit system; - - # Needed by the GCC wrapper. - langC = true; - langCC = true; - isGNU = true; - hardeningUnsupportedFlags = [ - "fortify3" - "stackclashprotection" - "trivialautovarinit" - "zerocallusedregs" - ]; -} // extraAttrs) diff --git a/pkgs/stdenv/linux/bootstrap-tools/glibc.nix b/pkgs/stdenv/linux/bootstrap-tools/glibc.nix new file mode 100644 index 000000000000..68a1438e3804 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-tools/glibc.nix @@ -0,0 +1,35 @@ +{ + 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" + "stackclashprotection" + "trivialautovarinit" + "zerocallusedregs" + ]; + } + // extraAttrs +) diff --git a/pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh b/pkgs/stdenv/linux/bootstrap-tools/glibc/unpack-bootstrap-tools.sh similarity index 100% rename from pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh rename to pkgs/stdenv/linux/bootstrap-tools/glibc/unpack-bootstrap-tools.sh diff --git a/pkgs/stdenv/linux/bootstrap-tools/musl.nix b/pkgs/stdenv/linux/bootstrap-tools/musl.nix new file mode 100644 index 000000000000..a3fdcc320718 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-tools/musl.nix @@ -0,0 +1,34 @@ +{ + 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" + "zerocallusedregs" + "trivialautovarinit" + ]; + } + // extraAttrs +) diff --git a/pkgs/stdenv/linux/bootstrap-tools-musl/scripts/unpack-bootstrap-tools.sh b/pkgs/stdenv/linux/bootstrap-tools/musl/unpack-bootstrap-tools.sh similarity index 100% rename from pkgs/stdenv/linux/bootstrap-tools-musl/scripts/unpack-bootstrap-tools.sh rename to pkgs/stdenv/linux/bootstrap-tools/musl/unpack-bootstrap-tools.sh diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index e1801abcb485..7b6718ae2d80 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -139,7 +139,7 @@ let # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...). - bootstrapTools = (import (if localSystem.libc == "musl" then ./bootstrap-tools-musl else ./bootstrap-tools) { + bootstrapTools = (import (if localSystem.libc == "musl" then ./bootstrap-tools/musl.nix else ./bootstrap-tools/glibc.nix) { inherit system bootstrapFiles; extraAttrs = lib.optionalAttrs config.contentAddressedByDefault { __contentAddressed = true; diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 192496e549d2..5796154b6b53 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -59,12 +59,12 @@ rec { }; in if (stdenv.hostPlatform.libc == "glibc") then - import ./bootstrap-tools { + import ./bootstrap-tools/glibc.nix { inherit (stdenv.buildPlatform) system; # Used to determine where to build inherit bootstrapFiles extraAttrs; } else if (stdenv.hostPlatform.libc == "musl") then - import ./bootstrap-tools-musl { + import ./bootstrap-tools/musl.nix { inherit (stdenv.buildPlatform) system; # Used to determine where to build inherit bootstrapFiles extraAttrs; }