From 9fdf395cc74f67644509424922815b238645fa16 Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Sun, 3 Sep 2023 18:27:49 +0100 Subject: makeStaticBinaries: Set -DCMAKE_SKIP_INSTALL_RPATH Without this, you get error messages during the install phase along the lines of: "file RPATH_CHANGE could not write new RPATH:". This is unsurprising because the static binaries do not have any dynamic linker and thus, no runpath to rewrite either. Tell cmake it doesn't need to do RPATH manipulation by passing cmakeFlags. While we're here, I also renamed `finalAttrs` to `args` and fixed the indentation; this improves consistency with the surrounding code and eliminates a point of confusion: because it was named `finalAttrs` I presumed I should be able to influence it with an overrideAttrs setting dontAddStaticConfigureFlags, but this turns out not to be possible; adding prevAttrs as well doesn't work because of a limitation of overrideAttrs whereby it gives an infinite recursion if the set of attribute keys being returned depends on finalAttrs. Signed-off-by: Peter Waller --- pkgs/stdenv/adapters.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index f29bdf671c8..000c254cf25 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -60,12 +60,13 @@ rec { mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args: if stdenv.hostPlatform.isDarwin then throw "Cannot build fully static binaries on Darwin/macOS" - else (mkDerivationSuper args).overrideAttrs(finalAttrs: { - NIX_CFLAGS_LINK = toString (finalAttrs.NIX_CFLAGS_LINK or "") + " -static"; - } // lib.optionalAttrs (!(finalAttrs.dontAddStaticConfigureFlags or false)) { - configureFlags = (finalAttrs.configureFlags or []) ++ [ - "--disable-shared" # brrr... - ]; + else (mkDerivationSuper args).overrideAttrs (args: { + NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -static"; + } // lib.optionalAttrs (!(args.dontAddStaticConfigureFlags or false)) { + configureFlags = (args.configureFlags or []) ++ [ + "--disable-shared" # brrr... + ]; + cmakeFlags = (args.cmakeFlags or []) ++ ["-DCMAKE_SKIP_INSTALL_RPATH=On"]; })); } // lib.optionalAttrs (stdenv0.hostPlatform.libc == "glibc") { extraBuildInputs = (old.extraBuildInputs or []) ++ [ -- cgit 1.4.1 From d0efa70d8114756ca5aeb875b7f3cf6d61543d62 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 21 Sep 2023 08:05:03 +0300 Subject: Revert "Revert "Merge pull request #253760 from chivay/bootstrap-scrt"" This reverts commit 3f46cdcb5b903fe1c07707fea9ee24ae09d964b2. --- pkgs/stdenv/linux/make-bootstrap-tools.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index d6c4da0ab2b..1334c13ad17 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -78,7 +78,8 @@ in with pkgs; rec { cp -d ${libc.out}/lib/libutil*.so* $out/lib cp -d ${libc.out}/lib/libnss*.so* $out/lib cp -d ${libc.out}/lib/libresolv*.so* $out/lib - cp -d ${libc.out}/lib/crt?.o $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 -- cgit 1.4.1 From df7bf1764399517b58d622d9b76f87c9561b3b99 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sun, 1 Oct 2023 23:53:15 +0300 Subject: bootstrap-tools-cross: remove bootstrap files for systems which are not used in stdenv/linux/default.nix --- pkgs/stdenv/linux/make-bootstrap-tools-cross.nix | 5 ----- 1 file changed, 5 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix index e67b5aef95c..c66acea685c 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix @@ -13,7 +13,6 @@ let }; in lib.mapAttrs (n: make) (with lib.systems.examples; { armv5tel = sheevaplug; - pogoplug4 = pogoplug4; armv6l = raspberryPi; armv7l = armv7l-hf-multiplatform; aarch64 = aarch64-multiplatform; @@ -21,12 +20,8 @@ in lib.mapAttrs (n: make) (with lib.systems.examples; { armv6l-musl = muslpi; aarch64-musl = aarch64-multiplatform-musl; riscv64 = riscv64; - loongarch64-linux = loongarch64-linux; mips64el-linux-gnuabin32 = mips64el-linux-gnuabin32; mips64el-linux-gnuabi64 = mips64el-linux-gnuabi64; mipsel-linux-gnu = mipsel-linux-gnu; - powerpc64 = ppc64; - powerpc64-musl = ppc64-musl; powerpc64le = powernv; - powerpc64le-musl = musl-power; }) -- cgit 1.4.1 From a1c2c50cbc481337294c9b75b85df36720ebee00 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sun, 1 Oct 2023 23:54:39 +0300 Subject: bootstrap-tools-cross: sort --- pkgs/stdenv/linux/make-bootstrap-tools-cross.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix index c66acea685c..1aebb898b64 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix @@ -12,16 +12,19 @@ let pkgs = releaseLib.pkgsForCross crossSystem system; }; in lib.mapAttrs (n: make) (with lib.systems.examples; { + # Sort following the sorting in `pkgs/stdenv/linux/default.nix` `bootstrapFiles` argument. armv5tel = sheevaplug; armv6l = raspberryPi; armv7l = armv7l-hf-multiplatform; aarch64 = aarch64-multiplatform; - x86_64-musl = musl64; - armv6l-musl = muslpi; - aarch64-musl = aarch64-multiplatform-musl; - riscv64 = riscv64; + mipsel-linux-gnu = mipsel-linux-gnu; mips64el-linux-gnuabin32 = mips64el-linux-gnuabin32; mips64el-linux-gnuabi64 = mips64el-linux-gnuabi64; - mipsel-linux-gnu = mipsel-linux-gnu; powerpc64le = powernv; + riscv64 = riscv64; + + # musl + aarch64-musl = aarch64-multiplatform-musl; + armv6l-musl = muslpi; + x86_64-musl = musl64; }) -- cgit 1.4.1 From 46ecf91843ed7cf4c16ce9073f8aa0a25ff6704a Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 30 Sep 2023 23:21:52 +0300 Subject: stdenv: remove unused loongson2f bootstrap files The last use of it was removed in (linux/default.nix: use mipsel.nix instead of longson.nix for mips32)[e8b10284f32b32469d5f54433e5c5a75448b327b]. --- pkgs/stdenv/linux/bootstrap-files/loongson2f.nix | 44 ------------------------ 1 file changed, 44 deletions(-) delete mode 100644 pkgs/stdenv/linux/bootstrap-files/loongson2f.nix (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/bootstrap-files/loongson2f.nix b/pkgs/stdenv/linux/bootstrap-files/loongson2f.nix deleted file mode 100644 index 8e22a274974..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/loongson2f.nix +++ /dev/null @@ -1,44 +0,0 @@ -let - - fetch = { file, sha256 }: import { - url = "http://tarballs.nixos.org/stdenv-linux/loongson2f/r22849/${file}"; - inherit sha256; - executable = true; - }; - -in { - sh = fetch { - file = "sh"; - sha256 = "02jjl49wdq85pgh61aqf78yaknn9mi3rcspbpk7hs9c4mida2rhf"; - }; - - bzip2 = fetch { - file = "bzip2"; - sha256 = "1qn27y3amj9c6mnjk2kyb59y0d2w4yv16z9apaxx91hyq19gf29z"; - }; - - mkdir = fetch { - file = "mkdir"; - sha256 = "1vbp2bv9hkyb2fwl8hjrffpywn1wrl1kc4yrwi2lirawlnc6kymh"; - }; - - cpio = fetch { - file = "cpio"; - sha256 = "0mqxwdx0sl7skxx6049mk35l7d0fnibqsv174284kdp4p7iixwa0"; - }; - - ln = fetch { - file = "ln"; - sha256 = "05lwx8qvga3yv8xhs8bjgsfygsfrcxsfck0lxw6gsdckx25fgi7s"; - }; - - curl = fetch { - file = "curl.bz2"; - sha256 = "0iblnz4my54gryac04i64fn3ksi9g3dx96yjq93fj39z6kx6151c"; - }; - - bootstrapTools = { - url = "http://tarballs.nixos.org/stdenv-linux/loongson2f/r22849/cross-bootstrap-tools.cpio.bz2"; - sha256 = "00aavbk76qjj2gdlmpaaj66r8nzl4d7pyl8cv1gigyzgpbr5vv3j"; - }; -} -- cgit 1.4.1 From 0848edf7a091235297aacb6de04677c1d70de1c4 Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 2 Oct 2023 01:30:11 +0300 Subject: bootstrap-tools-cross: Add a note about what should be here --- pkgs/stdenv/linux/make-bootstrap-tools-cross.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix index 1aebb898b64..b5e1b6c7a47 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix @@ -12,7 +12,9 @@ let pkgs = releaseLib.pkgsForCross crossSystem system; }; in lib.mapAttrs (n: make) (with lib.systems.examples; { - # Sort following the sorting in `pkgs/stdenv/linux/default.nix` `bootstrapFiles` argument. + # NOTE: Only add platforms for which there are files in `./bootstrap-files`. + # Sort following the sorting in `./default.nix` `bootstrapFiles` argument. + armv5tel = sheevaplug; armv6l = raspberryPi; armv7l = armv7l-hf-multiplatform; -- cgit 1.4.1 From 1270ef59e9aa2a2161c1e84779687a2c7a10c815 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sun, 1 Oct 2023 02:42:49 +0300 Subject: bootstrap-tools-cross: Rename bootstrap file jobs to be more descriptive Rename files in `bootstrap-files/` to match jobs in `make-bootstrap-tools-cross`. Should make automating the bootstrap files easier. ```nix $ nix repl --file ./pkgs/top-level/release-cross.nix nix-repl> bootstrapTools { aarch64-unknown-linux-gnu = { ... }; aarch64-unknown-linux-musl = { ... }; armv5tel-unknown-linux-gnueabi = { ... }; armv6l-unknown-linux-gnueabihf = { ... }; armv6l-unknown-linux-musleabihf = { ... }; armv7l-unknown-linux-gnueabihf = { ... }; mips64el-unknown-linux-gnuabi64 = {... }; mips64el-unknown-linux-gnuabin32 = { ... }; mipsel-unknown-linux-gnu = { ... }; powerpc64le-unknown-linux-gnu = { ... }; riscv64-unknown-linux-gnu = { ... }; x86_64-unknown-linux-musl = { ... }; } ``` Additionally if non-linux bootstrap files are added to `make-bootstrap-tools-cross` then there won't be any renaming needed. --- pkgs/stdenv/linux/bootstrap-files/aarch64-musl.nix | 11 --------- .../bootstrap-files/aarch64-unknown-linux-gnu.nix | 11 +++++++++ .../bootstrap-files/aarch64-unknown-linux-musl.nix | 11 +++++++++ pkgs/stdenv/linux/bootstrap-files/aarch64.nix | 11 --------- .../armv5tel-unknown-linux-gnueabi.nix | 18 ++++++++++++++ pkgs/stdenv/linux/bootstrap-files/armv5tel.nix | 18 -------------- pkgs/stdenv/linux/bootstrap-files/armv6l-musl.nix | 11 --------- .../armv6l-unknown-linux-gnueabihf.nix | 18 ++++++++++++++ .../armv6l-unknown-linux-musleabihf.nix | 11 +++++++++ pkgs/stdenv/linux/bootstrap-files/armv6l.nix | 18 -------------- .../armv7l-unknown-linux-gnueabihf.nix | 18 ++++++++++++++ pkgs/stdenv/linux/bootstrap-files/armv7l.nix | 18 -------------- .../bootstrap-files/i686-unknown-linux-gnu.nix | 12 ++++++++++ pkgs/stdenv/linux/bootstrap-files/i686.nix | 12 ---------- pkgs/stdenv/linux/bootstrap-files/mips64el-n32.nix | 25 ------------------- .../mips64el-unknown-linux-gnuabi64.nix | 25 +++++++++++++++++++ .../mips64el-unknown-linux-gnuabin32.nix | 25 +++++++++++++++++++ pkgs/stdenv/linux/bootstrap-files/mips64el.nix | 25 ------------------- .../bootstrap-files/mipsel-unknown-linux-gnu.nix | 25 +++++++++++++++++++ pkgs/stdenv/linux/bootstrap-files/mipsel.nix | 25 ------------------- .../powerpc64le-unknown-linux-gnu.nix | 25 +++++++++++++++++++ pkgs/stdenv/linux/bootstrap-files/powerpc64le.nix | 25 ------------------- .../bootstrap-files/riscv64-unknown-linux-gnu.nix | 12 ++++++++++ pkgs/stdenv/linux/bootstrap-files/riscv64.nix | 12 ---------- pkgs/stdenv/linux/bootstrap-files/x86_64-musl.nix | 11 --------- .../bootstrap-files/x86_64-unknown-linux-gnu.nix | 9 +++++++ .../bootstrap-files/x86_64-unknown-linux-musl.nix | 11 +++++++++ pkgs/stdenv/linux/bootstrap-files/x86_64.nix | 9 ------- pkgs/stdenv/linux/default.nix | 28 +++++++++++----------- pkgs/stdenv/linux/make-bootstrap-tools-cross.nix | 24 +++++++++---------- 30 files changed, 257 insertions(+), 257 deletions(-) delete mode 100644 pkgs/stdenv/linux/bootstrap-files/aarch64-musl.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/aarch64-unknown-linux-gnu.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/aarch64-unknown-linux-musl.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/aarch64.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/armv5tel-unknown-linux-gnueabi.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/armv5tel.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/armv6l-musl.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/armv6l-unknown-linux-gnueabihf.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/armv6l-unknown-linux-musleabihf.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/armv6l.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/armv7l-unknown-linux-gnueabihf.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/armv7l.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/i686-unknown-linux-gnu.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/i686.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/mips64el-n32.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/mips64el-unknown-linux-gnuabi64.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/mips64el-unknown-linux-gnuabin32.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/mips64el.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/mipsel-unknown-linux-gnu.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/mipsel.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/powerpc64le-unknown-linux-gnu.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/powerpc64le.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/riscv64-unknown-linux-gnu.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/riscv64.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/x86_64-musl.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/x86_64-unknown-linux-gnu.nix create mode 100644 pkgs/stdenv/linux/bootstrap-files/x86_64-unknown-linux-musl.nix delete mode 100644 pkgs/stdenv/linux/bootstrap-files/x86_64.nix (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/bootstrap-files/aarch64-musl.nix b/pkgs/stdenv/linux/bootstrap-files/aarch64-musl.nix deleted file mode 100644 index 252783cce47..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/aarch64-musl.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - busybox = import { - url = "https://wdtz.org/files/wjzsj9cmdkc70f78yh072483x8656nci-stdenv-bootstrap-tools-aarch64-unknown-linux-musl/on-server/busybox"; - sha256 = "01s6bwq84wyrjh3rdsgxni9gkzp7ss8rghg0cmp8zd87l79y8y4g"; - executable = true; - }; - bootstrapTools = import { - url = "https://wdtz.org/files/wjzsj9cmdkc70f78yh072483x8656nci-stdenv-bootstrap-tools-aarch64-unknown-linux-musl/on-server/bootstrap-tools.tar.xz"; - sha256 = "0pbqrw9z4ifkijpfpx15l2dzi00rq8c5zg9ghimz5qgr5dx7f7cl"; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/aarch64-unknown-linux-gnu.nix b/pkgs/stdenv/linux/bootstrap-files/aarch64-unknown-linux-gnu.nix new file mode 100644 index 00000000000..6719e7ca307 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/aarch64-unknown-linux-gnu.nix @@ -0,0 +1,11 @@ +{ + busybox = import { + url = "http://tarballs.nixos.org/stdenv-linux/aarch64/21ec906463ea8f11abf3f9091ddd4c3276516e58/busybox"; + executable = true; + hash = "sha256-0MuIeQlBUaeisqoFSu8y+8oB6K4ZG5Lhq8RcS9JqkFQ="; + }; + bootstrapTools = import { + url = "http://tarballs.nixos.org/stdenv-linux/aarch64/21ec906463ea8f11abf3f9091ddd4c3276516e58/bootstrap-tools.tar.xz"; + hash = "sha256-aJvtsWeuQHbb14BGZ2EiOKzjQn46h3x3duuPEawG0eE="; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/aarch64-unknown-linux-musl.nix b/pkgs/stdenv/linux/bootstrap-files/aarch64-unknown-linux-musl.nix new file mode 100644 index 00000000000..252783cce47 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/aarch64-unknown-linux-musl.nix @@ -0,0 +1,11 @@ +{ + busybox = import { + url = "https://wdtz.org/files/wjzsj9cmdkc70f78yh072483x8656nci-stdenv-bootstrap-tools-aarch64-unknown-linux-musl/on-server/busybox"; + sha256 = "01s6bwq84wyrjh3rdsgxni9gkzp7ss8rghg0cmp8zd87l79y8y4g"; + executable = true; + }; + bootstrapTools = import { + url = "https://wdtz.org/files/wjzsj9cmdkc70f78yh072483x8656nci-stdenv-bootstrap-tools-aarch64-unknown-linux-musl/on-server/bootstrap-tools.tar.xz"; + sha256 = "0pbqrw9z4ifkijpfpx15l2dzi00rq8c5zg9ghimz5qgr5dx7f7cl"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/aarch64.nix b/pkgs/stdenv/linux/bootstrap-files/aarch64.nix deleted file mode 100644 index 6719e7ca307..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/aarch64.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - busybox = import { - url = "http://tarballs.nixos.org/stdenv-linux/aarch64/21ec906463ea8f11abf3f9091ddd4c3276516e58/busybox"; - executable = true; - hash = "sha256-0MuIeQlBUaeisqoFSu8y+8oB6K4ZG5Lhq8RcS9JqkFQ="; - }; - bootstrapTools = import { - url = "http://tarballs.nixos.org/stdenv-linux/aarch64/21ec906463ea8f11abf3f9091ddd4c3276516e58/bootstrap-tools.tar.xz"; - hash = "sha256-aJvtsWeuQHbb14BGZ2EiOKzjQn46h3x3duuPEawG0eE="; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/armv5tel-unknown-linux-gnueabi.nix b/pkgs/stdenv/linux/bootstrap-files/armv5tel-unknown-linux-gnueabi.nix new file mode 100644 index 00000000000..0ac818b9f22 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/armv5tel-unknown-linux-gnueabi.nix @@ -0,0 +1,18 @@ +{ + # Note: do not use Hydra as a source URL. Ask a member of the + # infrastructure team to mirror the job. + busybox = import { + # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv5tel.dist/latest + # from build: https://hydra.nixos.org/build/114203025 + url = "http://tarballs.nixos.org/stdenv-linux/armv5tel/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/busybox"; + # note: the following hash is different than the above hash, due to executable = true + sha256 = "0qxp2fsvs4phbc17g9npj9bsm20ylr8myi5pivcrmxm5qqflgi8d"; + executable = true; + }; + bootstrapTools = import { + # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv5tel.dist/latest + # from build: https://hydra.nixos.org/build/114203025 + url = "http://tarballs.nixos.org/stdenv-linux/armv5tel/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/bootstrap-tools.tar.xz"; + sha256 = "28327343db5ecc7f7811449ec69280d5867fa5d1d377cab0426beb9d4e059ed6"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/armv5tel.nix b/pkgs/stdenv/linux/bootstrap-files/armv5tel.nix deleted file mode 100644 index 0ac818b9f22..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/armv5tel.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - # Note: do not use Hydra as a source URL. Ask a member of the - # infrastructure team to mirror the job. - busybox = import { - # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv5tel.dist/latest - # from build: https://hydra.nixos.org/build/114203025 - url = "http://tarballs.nixos.org/stdenv-linux/armv5tel/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/busybox"; - # note: the following hash is different than the above hash, due to executable = true - sha256 = "0qxp2fsvs4phbc17g9npj9bsm20ylr8myi5pivcrmxm5qqflgi8d"; - executable = true; - }; - bootstrapTools = import { - # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv5tel.dist/latest - # from build: https://hydra.nixos.org/build/114203025 - url = "http://tarballs.nixos.org/stdenv-linux/armv5tel/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/bootstrap-tools.tar.xz"; - sha256 = "28327343db5ecc7f7811449ec69280d5867fa5d1d377cab0426beb9d4e059ed6"; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/armv6l-musl.nix b/pkgs/stdenv/linux/bootstrap-files/armv6l-musl.nix deleted file mode 100644 index e445a7bba4d..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/armv6l-musl.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - busybox = import { - url = "https://wdtz.org/files/xmz441m69qrlfdw47l2k10zf87fsya6r-stdenv-bootstrap-tools-armv6l-unknown-linux-musleabihf/on-server/busybox"; - sha256 = "01d0hp1xgrriiy9w0sd9vbqzwxnpwiyah80pi4vrpcmbwji36j1i"; - executable = true; - }; - bootstrapTools = import { - url = "https://wdtz.org/files/xmz441m69qrlfdw47l2k10zf87fsya6r-stdenv-bootstrap-tools-armv6l-unknown-linux-musleabihf/on-server/bootstrap-tools.tar.xz"; - sha256 = "1r9mz9w8y5jd7gfwfsrvs20qarzxy7bvrp5dlm41hnx6z617if1h"; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/armv6l-unknown-linux-gnueabihf.nix b/pkgs/stdenv/linux/bootstrap-files/armv6l-unknown-linux-gnueabihf.nix new file mode 100644 index 00000000000..8bc99c64c68 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/armv6l-unknown-linux-gnueabihf.nix @@ -0,0 +1,18 @@ +{ + # Note: do not use Hydra as a source URL. Ask a member of the + # infrastructure team to mirror the job. + busybox = import { + # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv6l.dist/latest + # from build: https://hydra.nixos.org/build/114202834 + url = "http://tarballs.nixos.org/stdenv-linux/armv6l/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/busybox"; + # note: the following hash is different than the above hash, due to executable = true + sha256 = "1q02537cq56wlaxbz3s3kj5vmh6jbm27jhvga6b4m4jycz5sxxp6"; + executable = true; + }; + bootstrapTools = import { + # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv6l.dist/latest + # from build: https://hydra.nixos.org/build/114202834 + url = "http://tarballs.nixos.org/stdenv-linux/armv6l/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/bootstrap-tools.tar.xz"; + sha256 = "0810fe74f8cd09831f177d075bd451a66b71278d3cc8db55b07c5e38ef3fbf3f"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/armv6l-unknown-linux-musleabihf.nix b/pkgs/stdenv/linux/bootstrap-files/armv6l-unknown-linux-musleabihf.nix new file mode 100644 index 00000000000..e445a7bba4d --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/armv6l-unknown-linux-musleabihf.nix @@ -0,0 +1,11 @@ +{ + busybox = import { + url = "https://wdtz.org/files/xmz441m69qrlfdw47l2k10zf87fsya6r-stdenv-bootstrap-tools-armv6l-unknown-linux-musleabihf/on-server/busybox"; + sha256 = "01d0hp1xgrriiy9w0sd9vbqzwxnpwiyah80pi4vrpcmbwji36j1i"; + executable = true; + }; + bootstrapTools = import { + url = "https://wdtz.org/files/xmz441m69qrlfdw47l2k10zf87fsya6r-stdenv-bootstrap-tools-armv6l-unknown-linux-musleabihf/on-server/bootstrap-tools.tar.xz"; + sha256 = "1r9mz9w8y5jd7gfwfsrvs20qarzxy7bvrp5dlm41hnx6z617if1h"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/armv6l.nix b/pkgs/stdenv/linux/bootstrap-files/armv6l.nix deleted file mode 100644 index 8bc99c64c68..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/armv6l.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - # Note: do not use Hydra as a source URL. Ask a member of the - # infrastructure team to mirror the job. - busybox = import { - # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv6l.dist/latest - # from build: https://hydra.nixos.org/build/114202834 - url = "http://tarballs.nixos.org/stdenv-linux/armv6l/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/busybox"; - # note: the following hash is different than the above hash, due to executable = true - sha256 = "1q02537cq56wlaxbz3s3kj5vmh6jbm27jhvga6b4m4jycz5sxxp6"; - executable = true; - }; - bootstrapTools = import { - # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv6l.dist/latest - # from build: https://hydra.nixos.org/build/114202834 - url = "http://tarballs.nixos.org/stdenv-linux/armv6l/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/bootstrap-tools.tar.xz"; - sha256 = "0810fe74f8cd09831f177d075bd451a66b71278d3cc8db55b07c5e38ef3fbf3f"; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/armv7l-unknown-linux-gnueabihf.nix b/pkgs/stdenv/linux/bootstrap-files/armv7l-unknown-linux-gnueabihf.nix new file mode 100644 index 00000000000..74d15845223 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/armv7l-unknown-linux-gnueabihf.nix @@ -0,0 +1,18 @@ +{ + # Note: do not use Hydra as a source URL. Ask a member of the + # infrastructure team to mirror the job. + busybox = import { + # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv7l.dist/latest + # from build: https://hydra.nixos.org/build/114203060 + url = "http://tarballs.nixos.org/stdenv-linux/armv7l/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/busybox"; + # note: the following hash is different than the above hash, due to executable = true + sha256 = "18qc6w2yykh7nvhjklsqb2zb3fjh4p9r22nvmgj32jr1mjflcsjn"; + executable = true; + }; + bootstrapTools = import { + # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv7l.dist/latest + # from build: https://hydra.nixos.org/build/114203060 + url = "http://tarballs.nixos.org/stdenv-linux/armv7l/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/bootstrap-tools.tar.xz"; + sha256 = "cf2968e8085cd3e6b3e9359624060ad24d253800ede48c5338179f6e0082c443"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/armv7l.nix b/pkgs/stdenv/linux/bootstrap-files/armv7l.nix deleted file mode 100644 index 74d15845223..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/armv7l.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - # Note: do not use Hydra as a source URL. Ask a member of the - # infrastructure team to mirror the job. - busybox = import { - # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv7l.dist/latest - # from build: https://hydra.nixos.org/build/114203060 - url = "http://tarballs.nixos.org/stdenv-linux/armv7l/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/busybox"; - # note: the following hash is different than the above hash, due to executable = true - sha256 = "18qc6w2yykh7nvhjklsqb2zb3fjh4p9r22nvmgj32jr1mjflcsjn"; - executable = true; - }; - bootstrapTools = import { - # from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv7l.dist/latest - # from build: https://hydra.nixos.org/build/114203060 - url = "http://tarballs.nixos.org/stdenv-linux/armv7l/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/bootstrap-tools.tar.xz"; - sha256 = "cf2968e8085cd3e6b3e9359624060ad24d253800ede48c5338179f6e0082c443"; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/i686-unknown-linux-gnu.nix b/pkgs/stdenv/linux/bootstrap-files/i686-unknown-linux-gnu.nix new file mode 100644 index 00000000000..112d37670c8 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/i686-unknown-linux-gnu.nix @@ -0,0 +1,12 @@ +{ + busybox = import { + url = "http://tarballs.nixos.org/stdenv-linux/i686/4907fc9e8d0d82b28b3c56e3a478a2882f1d700f/busybox"; + sha256 = "ef4c1be6c7ae57e4f654efd90ae2d2e204d6769364c46469fa9ff3761195cba1"; + executable = true; + }; + + bootstrapTools = import { + url = "http://tarballs.nixos.org/stdenv-linux/i686/c5aabb0d603e2c1ea05f5a93b3be82437f5ebf31/bootstrap-tools.tar.xz"; + sha256 = "b9bf20315f8c5c0411679c5326084420b522046057a0850367c67d9514794f1c"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/i686.nix b/pkgs/stdenv/linux/bootstrap-files/i686.nix deleted file mode 100644 index 112d37670c8..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/i686.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - busybox = import { - url = "http://tarballs.nixos.org/stdenv-linux/i686/4907fc9e8d0d82b28b3c56e3a478a2882f1d700f/busybox"; - sha256 = "ef4c1be6c7ae57e4f654efd90ae2d2e204d6769364c46469fa9ff3761195cba1"; - executable = true; - }; - - bootstrapTools = import { - url = "http://tarballs.nixos.org/stdenv-linux/i686/c5aabb0d603e2c1ea05f5a93b3be82437f5ebf31/bootstrap-tools.tar.xz"; - sha256 = "b9bf20315f8c5c0411679c5326084420b522046057a0850367c67d9514794f1c"; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/mips64el-n32.nix b/pkgs/stdenv/linux/bootstrap-files/mips64el-n32.nix deleted file mode 100644 index cf26c2113ec..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/mips64el-n32.nix +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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 { - url = "http://tarballs.nixos.org/stdenv-linux/mips64el-n32/97d9c84e1df4397b43ecb39359f1bd003cd44585/busybox"; - sha256 = "sha256-4N3G1qYA7vitjhsIW17pR6UixIuzrq4vZXa8F0/X4iI="; - executable = true; - }; - bootstrapTools = import { - url = "http://tarballs.nixos.org/stdenv-linux/mips64el-n32/97d9c84e1df4397b43ecb39359f1bd003cd44585/bootstrap-tools.tar.xz"; - sha256 = "sha256-LWrpN6su2yNVurUyhZP34OiZyzgh7MfN13fIIbou8KI="; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/mips64el-unknown-linux-gnuabi64.nix b/pkgs/stdenv/linux/bootstrap-files/mips64el-unknown-linux-gnuabi64.nix new file mode 100644 index 00000000000..452a247fb0b --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/mips64el-unknown-linux-gnuabi64.nix @@ -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 { + url = "http://tarballs.nixos.org/stdenv-linux/mips64el/ef3fe254f3c59455386bc92fe84164f9679b92b1/busybox"; + sha256 = "sha256-sTE58ofjqAqX3Xtq1g9wDxzIe6Vo//GHbicfqJoivDI="; + executable = true; + }; + bootstrapTools =import { + url = "http://tarballs.nixos.org/stdenv-linux/mips64el/ef3fe254f3c59455386bc92fe84164f9679b92b1/bootstrap-tools.tar.xz"; + sha256 = "sha256-tTgjeXpd2YgnfP4JvRuO0bXd2j8GqzBcd57JI3wH9x0="; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/mips64el-unknown-linux-gnuabin32.nix b/pkgs/stdenv/linux/bootstrap-files/mips64el-unknown-linux-gnuabin32.nix new file mode 100644 index 00000000000..cf26c2113ec --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/mips64el-unknown-linux-gnuabin32.nix @@ -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 { + url = "http://tarballs.nixos.org/stdenv-linux/mips64el-n32/97d9c84e1df4397b43ecb39359f1bd003cd44585/busybox"; + sha256 = "sha256-4N3G1qYA7vitjhsIW17pR6UixIuzrq4vZXa8F0/X4iI="; + executable = true; + }; + bootstrapTools = import { + url = "http://tarballs.nixos.org/stdenv-linux/mips64el-n32/97d9c84e1df4397b43ecb39359f1bd003cd44585/bootstrap-tools.tar.xz"; + sha256 = "sha256-LWrpN6su2yNVurUyhZP34OiZyzgh7MfN13fIIbou8KI="; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/mips64el.nix b/pkgs/stdenv/linux/bootstrap-files/mips64el.nix deleted file mode 100644 index 452a247fb0b..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/mips64el.nix +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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 { - url = "http://tarballs.nixos.org/stdenv-linux/mips64el/ef3fe254f3c59455386bc92fe84164f9679b92b1/busybox"; - sha256 = "sha256-sTE58ofjqAqX3Xtq1g9wDxzIe6Vo//GHbicfqJoivDI="; - executable = true; - }; - bootstrapTools =import { - url = "http://tarballs.nixos.org/stdenv-linux/mips64el/ef3fe254f3c59455386bc92fe84164f9679b92b1/bootstrap-tools.tar.xz"; - sha256 = "sha256-tTgjeXpd2YgnfP4JvRuO0bXd2j8GqzBcd57JI3wH9x0="; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/mipsel-unknown-linux-gnu.nix b/pkgs/stdenv/linux/bootstrap-files/mipsel-unknown-linux-gnu.nix new file mode 100644 index 00000000000..42f2e871d92 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/mipsel-unknown-linux-gnu.nix @@ -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 { + url = "http://tarballs.nixos.org/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/busybox"; + hash = "sha256-EhuzjL52VEIOfEcFdVGZaDMClQbMc9V9ISrTUNaA7HQ="; + executable = true; + }; + bootstrapTools = import { + url = "http://tarballs.nixos.org/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/bootstrap-tools.tar.xz"; + hash = "sha256-OEGgLJOLnV+aobsb+P8mY3Dp8qbeVODBH6x3aUE/MGM="; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/mipsel.nix b/pkgs/stdenv/linux/bootstrap-files/mipsel.nix deleted file mode 100644 index 42f2e871d92..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/mipsel.nix +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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 { - url = "http://tarballs.nixos.org/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/busybox"; - hash = "sha256-EhuzjL52VEIOfEcFdVGZaDMClQbMc9V9ISrTUNaA7HQ="; - executable = true; - }; - bootstrapTools = import { - url = "http://tarballs.nixos.org/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/bootstrap-tools.tar.xz"; - hash = "sha256-OEGgLJOLnV+aobsb+P8mY3Dp8qbeVODBH6x3aUE/MGM="; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/powerpc64le-unknown-linux-gnu.nix b/pkgs/stdenv/linux/bootstrap-files/powerpc64le-unknown-linux-gnu.nix new file mode 100644 index 00000000000..c35cb9b102c --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/powerpc64le-unknown-linux-gnu.nix @@ -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 { + url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/ac43c444780a80e789fd14fe2114acd4a3b5cf9d/busybox"; + sha256 = "sha256-jtPEAsht4AUAG4MLK8xocQSfveUR4ppU1lS4bGI1VN4="; + executable = true; + }; + bootstrapTools = import { + url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/ac43c444780a80e789fd14fe2114acd4a3b5cf9d/bootstrap-tools.tar.xz"; + sha256 = "sha256-MpIDnpZUK3M17qlnuoxfnK0EgxRosm3TMW1WfPZ1+jU="; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/powerpc64le.nix b/pkgs/stdenv/linux/bootstrap-files/powerpc64le.nix deleted file mode 100644 index c35cb9b102c..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/powerpc64le.nix +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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 { - url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/ac43c444780a80e789fd14fe2114acd4a3b5cf9d/busybox"; - sha256 = "sha256-jtPEAsht4AUAG4MLK8xocQSfveUR4ppU1lS4bGI1VN4="; - executable = true; - }; - bootstrapTools = import { - url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/ac43c444780a80e789fd14fe2114acd4a3b5cf9d/bootstrap-tools.tar.xz"; - sha256 = "sha256-MpIDnpZUK3M17qlnuoxfnK0EgxRosm3TMW1WfPZ1+jU="; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/riscv64-unknown-linux-gnu.nix b/pkgs/stdenv/linux/bootstrap-files/riscv64-unknown-linux-gnu.nix new file mode 100644 index 00000000000..aaf1f153c78 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/riscv64-unknown-linux-gnu.nix @@ -0,0 +1,12 @@ +{ + busybox = import { + url = "http://tarballs.nixos.org/stdenv-linux/riscv64/9bd3cf0063b80428bd85a286205adab4b6ffcbd6/busybox"; + sha256 = "6f61912f94bc4ef287d1ff48a9521ed16bd07d8d8ec775e471f32c64d346583d"; + executable = true; + }; + + bootstrapTools = import { + url = "http://tarballs.nixos.org/stdenv-linux/riscv64/9bd3cf0063b80428bd85a286205adab4b6ffcbd6/bootstrap-tools.tar.xz"; + sha256 = "5466b19288e980125fc62ebb864d09908ffe0bc50cebe52cfee89acff14d5b9f"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/riscv64.nix b/pkgs/stdenv/linux/bootstrap-files/riscv64.nix deleted file mode 100644 index aaf1f153c78..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/riscv64.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - busybox = import { - url = "http://tarballs.nixos.org/stdenv-linux/riscv64/9bd3cf0063b80428bd85a286205adab4b6ffcbd6/busybox"; - sha256 = "6f61912f94bc4ef287d1ff48a9521ed16bd07d8d8ec775e471f32c64d346583d"; - executable = true; - }; - - bootstrapTools = import { - url = "http://tarballs.nixos.org/stdenv-linux/riscv64/9bd3cf0063b80428bd85a286205adab4b6ffcbd6/bootstrap-tools.tar.xz"; - sha256 = "5466b19288e980125fc62ebb864d09908ffe0bc50cebe52cfee89acff14d5b9f"; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/x86_64-musl.nix b/pkgs/stdenv/linux/bootstrap-files/x86_64-musl.nix deleted file mode 100644 index 98a65bd7764..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/x86_64-musl.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - busybox = import { - url = "https://wdtz.org/files/gywxhjgl70sxippa0pxs0vj5qcgz1wi8-stdenv-bootstrap-tools/on-server/busybox"; - sha256 = "0779c2wn00467h76xpqil678gfi1y2p57c7zq2d917jsv2qj5009"; - executable = true; - }; - bootstrapTools = import { - url = "https://wdtz.org/files/gywxhjgl70sxippa0pxs0vj5qcgz1wi8-stdenv-bootstrap-tools/on-server/bootstrap-tools.tar.xz"; - sha256 = "1dwiqw4xvnm0b5fdgl89lz2qq45f6s9icwxn6n6ams71xw0dbqyi"; - }; -} diff --git a/pkgs/stdenv/linux/bootstrap-files/x86_64-unknown-linux-gnu.nix b/pkgs/stdenv/linux/bootstrap-files/x86_64-unknown-linux-gnu.nix new file mode 100644 index 00000000000..1eefa4f3d6d --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/x86_64-unknown-linux-gnu.nix @@ -0,0 +1,9 @@ +# Use busybox for i686-linux since it works on x86_64-linux as well. +(import ./i686-unknown-linux-gnu.nix) // + +{ + bootstrapTools = import { + url = "http://tarballs.nixos.org/stdenv-linux/x86_64/c5aabb0d603e2c1ea05f5a93b3be82437f5ebf31/bootstrap-tools.tar.xz"; + sha256 = "a5ce9c155ed09397614646c9717fc7cd94b1023d7b76b618d409e4fefd6e9d39"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/x86_64-unknown-linux-musl.nix b/pkgs/stdenv/linux/bootstrap-files/x86_64-unknown-linux-musl.nix new file mode 100644 index 00000000000..98a65bd7764 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-files/x86_64-unknown-linux-musl.nix @@ -0,0 +1,11 @@ +{ + busybox = import { + url = "https://wdtz.org/files/gywxhjgl70sxippa0pxs0vj5qcgz1wi8-stdenv-bootstrap-tools/on-server/busybox"; + sha256 = "0779c2wn00467h76xpqil678gfi1y2p57c7zq2d917jsv2qj5009"; + executable = true; + }; + bootstrapTools = import { + url = "https://wdtz.org/files/gywxhjgl70sxippa0pxs0vj5qcgz1wi8-stdenv-bootstrap-tools/on-server/bootstrap-tools.tar.xz"; + sha256 = "1dwiqw4xvnm0b5fdgl89lz2qq45f6s9icwxn6n6ams71xw0dbqyi"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap-files/x86_64.nix b/pkgs/stdenv/linux/bootstrap-files/x86_64.nix deleted file mode 100644 index bdfa98c89cb..00000000000 --- a/pkgs/stdenv/linux/bootstrap-files/x86_64.nix +++ /dev/null @@ -1,9 +0,0 @@ -# Use busybox for i686-linux since it works on x86_64-linux as well. -(import ./i686.nix) // - -{ - bootstrapTools = import { - url = "http://tarballs.nixos.org/stdenv-linux/x86_64/c5aabb0d603e2c1ea05f5a93b3be82437f5ebf31/bootstrap-tools.tar.xz"; - sha256 = "a5ce9c155ed09397614646c9717fc7cd94b1023d7b76b618d409e4fefd6e9d39"; - }; -} diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 34fffd36aa6..5c03312cc75 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -59,24 +59,24 @@ , bootstrapFiles ? let table = { glibc = { - i686-linux = import ./bootstrap-files/i686.nix; - x86_64-linux = import ./bootstrap-files/x86_64.nix; - armv5tel-linux = import ./bootstrap-files/armv5tel.nix; - armv6l-linux = import ./bootstrap-files/armv6l.nix; - armv7l-linux = import ./bootstrap-files/armv7l.nix; - aarch64-linux = import ./bootstrap-files/aarch64.nix; - mipsel-linux = import ./bootstrap-files/mipsel.nix; + 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-n32.nix - else ./bootstrap-files/mips64el.nix); - powerpc64le-linux = import ./bootstrap-files/powerpc64le.nix; - riscv64-linux = import ./bootstrap-files/riscv64.nix; + then ./bootstrap-files/mips64el-unknown-linux-gnuabin32.nix.nix + else ./bootstrap-files/mips64el-unknown-linux-gnuabi64.nix); + powerpc64le-linux = import ./bootstrap-files/powerpc64le-unknown-linux-gnu.nix; + riscv64-linux = import ./bootstrap-files/riscv64-unknown-linux-gnu.nix; }; musl = { - aarch64-linux = import ./bootstrap-files/aarch64-musl.nix; - armv6l-linux = import ./bootstrap-files/armv6l-musl.nix; - x86_64-linux = import ./bootstrap-files/x86_64-musl.nix; + 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; }; }; diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix index b5e1b6c7a47..124575af688 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix @@ -15,18 +15,18 @@ in lib.mapAttrs (n: make) (with lib.systems.examples; { # NOTE: Only add platforms for which there are files in `./bootstrap-files`. # Sort following the sorting in `./default.nix` `bootstrapFiles` argument. - armv5tel = sheevaplug; - armv6l = raspberryPi; - armv7l = armv7l-hf-multiplatform; - aarch64 = aarch64-multiplatform; - mipsel-linux-gnu = mipsel-linux-gnu; - mips64el-linux-gnuabin32 = mips64el-linux-gnuabin32; - mips64el-linux-gnuabi64 = mips64el-linux-gnuabi64; - powerpc64le = powernv; - riscv64 = riscv64; + 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; + powerpc64le-unknown-linux-gnu = powernv; + riscv64-unknown-linux-gnu = riscv64; # musl - aarch64-musl = aarch64-multiplatform-musl; - armv6l-musl = muslpi; - x86_64-musl = musl64; + aarch64-unknown-linux-musl = aarch64-multiplatform-musl; + armv6l-unknown-linux-musleabihf = muslpi; + x86_64-unknown-linux-musl = musl64; }) -- cgit 1.4.1 From 53c5f084151264701e6332f1606bb892bf9c3574 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 28 Sep 2023 11:05:52 +0200 Subject: stdenv: refactor `.attrs.sh` detection Relying on `.attrs.sh` to exist in `$NIX_BUILD_TOP` is problematic because that's not compatible with how `nix-shell(1)` behaves. It places `.attrs.{json,sh}` into a temporary directory and makes them accessible via `$NIX_ATTRS_{SH,JSON}_FILE` in the environment[1]. The sole reason that `nix-shell(1)` still works with structured-attrs enabled derivations is that the contents of `.attrs.sh` are sourced into the shell before sourcing `$stdenv/setup` (if `$stdenv` exists) by `nix-shell`. However, the assumption that two files called `.attrs.sh` and `.attrs.json` exist in `$NIX_BUILD_TOP` is wrong in an interactive shell session and thus an inconsistency between shell debug session and actual builds which can lead to unexpected problems. To be precise, we currently have the following problem: an expression like with import ./. {}; runCommand "foo" { __structuredAttrs = true; foo.bar = [ 1 2 3 ]; } '' echo "''${__structuredAttrs@Q}" touch $out '' prints `1` in its build-log. However when building interactively in a `nix-shell`, it doesn't. Because of that, I'm considering to propose a full deprecation of `$NIX_BUILD_TOP/.attrs.{json,sh}`. A first step is to only mention the environment variables, but not the actual paths anymore in Nix's manual[2]. The second step - this patch - is to fix nixpkgs' stdenv accordingly. Please note that we cannot check for `-e "$NIX_ATTRS_JSON_FILE"` because certain outdated Nix minors (that are still in the range of supported Nix versions in `nixpkgs`) have a bug where `NIX_ATTRS_JSON_FILE` points to the wrong file while building[3]. Also, for compatibility with Nix 2.3 which doesn't provide these environment variables at all we still need to check for the existence of .attrs.json/.attrs.sh here. As soon as we bump nixpkgs' minver to 2.4, this can be dropped. Finally, dropped the check for ATTRS_SH_FILE because that was never relevant. In nix#4770 the ATTRS_SH_FILE variable was introduced[4] and in a review iteration prefixed with NIX_[5]. In other words, these variables were never part of a release and you'd only have this problem if you'd use a Nix from a git revision of my branch from back then. In other words, that's dead code. [1] https://github.com/nixos/nix/pull/4770#issuecomment-834718851 [2] https://github.com/NixOS/nix/pull/9032 [3] https://github.com/NixOS/nix/issues/6736 [4] https://github.com/NixOS/nix/pull/4770/commits/3944a120ec6986c723bf36bfade9b331dd4af68a [5] https://github.com/NixOS/nix/pull/4770/commits/27ce722638eeabb987bc9b4a1234c2818c5bf401 --- pkgs/stdenv/generic/setup.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index ad9857fc9d6..419a66261e6 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -16,29 +16,15 @@ if (( "${NIX_DEBUG:-0}" >= 6 )); then set -x fi -if [ -f .attrs.sh ]; then +if [ -f .attrs.sh ] || [[ -n "${NIX_ATTRS_JSON_FILE:-}" ]]; then __structuredAttrs=1 echo "structuredAttrs is enabled" -else - __structuredAttrs= -fi -if [ -n "$__structuredAttrs" ]; then for outputName in "${!outputs[@]}"; do # ex: out=/nix/store/... export "$outputName=${outputs[$outputName]}" done - # Before Nix 2.4, $NIX_ATTRS_*_FILE was named differently: - # https://github.com/NixOS/nix/commit/27ce722 - if [[ -n "${ATTRS_JSON_FILE:-}" ]]; then - export NIX_ATTRS_JSON_FILE="$ATTRS_JSON_FILE" - fi - - if [[ -n "${ATTRS_SH_FILE:-}" ]]; then - export NIX_ATTRS_SH_FILE="$ATTRS_SH_FILE" - fi - # $NIX_ATTRS_JSON_FILE pointed to the wrong location in sandbox # https://github.com/NixOS/nix/issues/6736; please keep around until the # fix reaches *every patch version* that's >= lib/minver.nix @@ -49,6 +35,7 @@ if [ -n "$__structuredAttrs" ]; then export NIX_ATTRS_SH_FILE="$NIX_BUILD_TOP/.attrs.sh" fi else + __structuredAttrs= : "${outputs:=out}" fi -- cgit 1.4.1 From 8bc5104a6e6a6acf09f9d7ddf1c6a9293efb405a Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 28 Sep 2023 15:09:26 +0200 Subject: treewide: refactor `.attrs.sh` detection When specifying the `builder` attribute in `stdenv.mkDerivation`, this will be effectively transformed into builtins.derivation { builder = stdenv.shell; args = [ "-e" builder ]; } This also means that `default-builder.sh` is never sourced and as a result it's not guaranteed that `$NIX_ATTRS_SH_FILE` is set to a correct location[1]. Also, we need to source `.attrs.sh` to source `$stdenv`. So, the following is done now: * If `$NIX_ATTRS_SH_FILE` points to a correct location, then use it. Directly using `.attrs.sh` is problematic for `nix-shell(1)` usage (see previous commit for more context), so prefer the environment variable if possible. * Otherwise, if `.attrs.sh` exists, then use it. See [1] for when this can happen. * If neither applies, it can be assumed that `__structuredAttrs` is turned off and thus nothing needs to be done. [1] It's possible that it doesn't exist at all - in case of Nix 2.3 or it can point to a wrong location on older Nix versions with a bug in `__structuredAttrs`. --- nixos/modules/services/networking/ircd-hybrid/builder.sh | 2 +- nixos/modules/services/web-servers/jboss/builder.sh | 2 +- pkgs/applications/misc/adobe-reader/builder.sh | 2 +- pkgs/build-support/fetchbzr/builder.sh | 2 +- pkgs/build-support/fetchcvs/builder.sh | 2 +- pkgs/build-support/fetchdarcs/builder.sh | 2 +- pkgs/build-support/fetchdocker/fetchdocker-builder.sh | 2 +- pkgs/build-support/fetchfossil/builder.sh | 2 +- pkgs/build-support/fetchgit/builder.sh | 2 +- pkgs/build-support/fetchhg/builder.sh | 2 +- pkgs/build-support/fetchipfs/builder.sh | 2 +- pkgs/build-support/fetchmtn/builder.sh | 2 +- pkgs/build-support/fetchsvn/builder.sh | 2 +- pkgs/build-support/fetchsvnssh/builder.sh | 2 +- pkgs/build-support/fetchurl/builder.sh | 2 +- pkgs/desktops/gnustep/make/builder.sh | 2 +- pkgs/development/compilers/aspectj/builder.sh | 2 +- pkgs/development/compilers/chicken/4/fetchegg/builder.sh | 2 +- pkgs/development/compilers/fpc/binary-builder-darwin.sh | 2 +- pkgs/development/compilers/fpc/binary-builder.sh | 2 +- pkgs/development/compilers/ios-cross-compile/9.2_builder.sh | 2 +- pkgs/development/compilers/ocaml/builder.sh | 2 +- pkgs/development/libraries/glibc/locales-builder.sh | 2 +- pkgs/development/libraries/gtk-sharp/builder.sh | 2 +- pkgs/development/libraries/wtk/builder.sh | 2 +- pkgs/development/perl-modules/generic/builder.sh | 2 +- pkgs/development/tools/build-managers/boot/builder.sh | 2 +- pkgs/development/tools/misc/automake/builder.sh | 2 +- pkgs/development/tools/parsing/antlr/builder.sh | 2 +- pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh | 2 +- pkgs/os-specific/linux/nvidia-x11/builder.sh | 2 +- pkgs/os-specific/linux/opengl/xorg-sys/builder.sh | 2 +- pkgs/servers/http/tomcat/axis2/builder.sh | 2 +- pkgs/servers/x11/xorg/builder.sh | 2 +- pkgs/stdenv/generic/default-builder.sh | 4 +--- pkgs/test/simple/builder.sh | 2 +- 36 files changed, 36 insertions(+), 38 deletions(-) (limited to 'pkgs/stdenv') diff --git a/nixos/modules/services/networking/ircd-hybrid/builder.sh b/nixos/modules/services/networking/ircd-hybrid/builder.sh index d9d2e4264df..07a3788abf7 100644 --- a/nixos/modules/services/networking/ircd-hybrid/builder.sh +++ b/nixos/modules/services/networking/ircd-hybrid/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup doSub() { diff --git a/nixos/modules/services/web-servers/jboss/builder.sh b/nixos/modules/services/web-servers/jboss/builder.sh index ac573089cd5..8c49b87db06 100644 --- a/nixos/modules/services/web-servers/jboss/builder.sh +++ b/nixos/modules/services/web-servers/jboss/builder.sh @@ -1,6 +1,6 @@ set -e -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup mkdir -p $out/bin diff --git a/pkgs/applications/misc/adobe-reader/builder.sh b/pkgs/applications/misc/adobe-reader/builder.sh index 6047c082643..4291da80576 100644 --- a/pkgs/applications/misc/adobe-reader/builder.sh +++ b/pkgs/applications/misc/adobe-reader/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup echo "unpacking $src..." diff --git a/pkgs/build-support/fetchbzr/builder.sh b/pkgs/build-support/fetchbzr/builder.sh index 991864719a0..4515e0e82f4 100644 --- a/pkgs/build-support/fetchbzr/builder.sh +++ b/pkgs/build-support/fetchbzr/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source "$stdenv/setup" echo "exporting \`$url' (revision $rev) into \`$out'" diff --git a/pkgs/build-support/fetchcvs/builder.sh b/pkgs/build-support/fetchcvs/builder.sh index 4b49e9676ec..7e4dde4a64c 100644 --- a/pkgs/build-support/fetchcvs/builder.sh +++ b/pkgs/build-support/fetchcvs/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup (echo "#!$SHELL"; \ diff --git a/pkgs/build-support/fetchdarcs/builder.sh b/pkgs/build-support/fetchdarcs/builder.sh index 75b9066dba6..39838db255a 100644 --- a/pkgs/build-support/fetchdarcs/builder.sh +++ b/pkgs/build-support/fetchdarcs/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup tagtext="" diff --git a/pkgs/build-support/fetchdocker/fetchdocker-builder.sh b/pkgs/build-support/fetchdocker/fetchdocker-builder.sh index 4eb70f672d4..489914a2a8b 100644 --- a/pkgs/build-support/fetchdocker/fetchdocker-builder.sh +++ b/pkgs/build-support/fetchdocker/fetchdocker-builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source "${stdenv}/setup" echo "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}" mkdir -p "${out}" diff --git a/pkgs/build-support/fetchfossil/builder.sh b/pkgs/build-support/fetchfossil/builder.sh index 36b758ab574..fe828d0ada9 100644 --- a/pkgs/build-support/fetchfossil/builder.sh +++ b/pkgs/build-support/fetchfossil/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup echo "Cloning Fossil $url [$rev] into $out" diff --git a/pkgs/build-support/fetchgit/builder.sh b/pkgs/build-support/fetchgit/builder.sh index 77f6381b09a..95176beea8c 100644 --- a/pkgs/build-support/fetchgit/builder.sh +++ b/pkgs/build-support/fetchgit/builder.sh @@ -3,7 +3,7 @@ # - revision specified and remote has a HEAD # - revision specified and remote without HEAD # -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup echo "exporting $url (rev $rev) into $out" diff --git a/pkgs/build-support/fetchhg/builder.sh b/pkgs/build-support/fetchhg/builder.sh index 1ce29475771..20dfde4b10d 100644 --- a/pkgs/build-support/fetchhg/builder.sh +++ b/pkgs/build-support/fetchhg/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup echo "getting $url${rev:+ ($rev)} into $out" diff --git a/pkgs/build-support/fetchipfs/builder.sh b/pkgs/build-support/fetchipfs/builder.sh index ca77962b538..1ddd111b151 100644 --- a/pkgs/build-support/fetchipfs/builder.sh +++ b/pkgs/build-support/fetchipfs/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup # Curl flags to handle redirects, not use EPSV, handle cookies for diff --git a/pkgs/build-support/fetchmtn/builder.sh b/pkgs/build-support/fetchmtn/builder.sh index 1aabd7949ee..de929fad55a 100644 --- a/pkgs/build-support/fetchmtn/builder.sh +++ b/pkgs/build-support/fetchmtn/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup set -x diff --git a/pkgs/build-support/fetchsvn/builder.sh b/pkgs/build-support/fetchsvn/builder.sh index aa4d049aba4..e187747f14e 100644 --- a/pkgs/build-support/fetchsvn/builder.sh +++ b/pkgs/build-support/fetchsvn/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup echo "exporting $url (r$rev) into $out" diff --git a/pkgs/build-support/fetchsvnssh/builder.sh b/pkgs/build-support/fetchsvnssh/builder.sh index 5782151524f..e553446346d 100644 --- a/pkgs/build-support/fetchsvnssh/builder.sh +++ b/pkgs/build-support/fetchsvnssh/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup echo "exporting $url (r$rev) into $out" diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh index e8eaba93485..a82728ef102 100644 --- a/pkgs/build-support/fetchurl/builder.sh +++ b/pkgs/build-support/fetchurl/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup source $mirrorsFile diff --git a/pkgs/desktops/gnustep/make/builder.sh b/pkgs/desktops/gnustep/make/builder.sh index 736635ab502..79ead3f7b72 100644 --- a/pkgs/desktops/gnustep/make/builder.sh +++ b/pkgs/desktops/gnustep/make/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup providedPreConfigure="$preConfigure"; diff --git a/pkgs/development/compilers/aspectj/builder.sh b/pkgs/development/compilers/aspectj/builder.sh index 7ea0a40d374..31ec97942e5 100755 --- a/pkgs/development/compilers/aspectj/builder.sh +++ b/pkgs/development/compilers/aspectj/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup export JAVA_HOME=$jre diff --git a/pkgs/development/compilers/chicken/4/fetchegg/builder.sh b/pkgs/development/compilers/chicken/4/fetchegg/builder.sh index cb56eabc5d7..78535382a7c 100644 --- a/pkgs/development/compilers/chicken/4/fetchegg/builder.sh +++ b/pkgs/development/compilers/chicken/4/fetchegg/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup echo "exporting egg ${eggName} (version $version) into $out" diff --git a/pkgs/development/compilers/fpc/binary-builder-darwin.sh b/pkgs/development/compilers/fpc/binary-builder-darwin.sh index 39db0518281..8a8600f1f63 100755 --- a/pkgs/development/compilers/fpc/binary-builder-darwin.sh +++ b/pkgs/development/compilers/fpc/binary-builder-darwin.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup pkgdir=$(pwd)/pkg diff --git a/pkgs/development/compilers/fpc/binary-builder.sh b/pkgs/development/compilers/fpc/binary-builder.sh index c471378c275..568c3094107 100755 --- a/pkgs/development/compilers/fpc/binary-builder.sh +++ b/pkgs/development/compilers/fpc/binary-builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup tar xf $src diff --git a/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh b/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh index 47459664af0..4eef8acb069 100644 --- a/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh +++ b/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh @@ -1,5 +1,5 @@ # -*- shell-script -*- -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup function extract diff --git a/pkgs/development/compilers/ocaml/builder.sh b/pkgs/development/compilers/ocaml/builder.sh index 88acc0654cf..85b26848f4e 100644 --- a/pkgs/development/compilers/ocaml/builder.sh +++ b/pkgs/development/compilers/ocaml/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup configureFlags="-prefix $out $configureFlags" diff --git a/pkgs/development/libraries/glibc/locales-builder.sh b/pkgs/development/libraries/glibc/locales-builder.sh index d91f936c937..27894b09b91 100644 --- a/pkgs/development/libraries/glibc/locales-builder.sh +++ b/pkgs/development/libraries/glibc/locales-builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi # Glibc cannot have itself in its RPATH. export NIX_NO_SELF_RPATH=1 diff --git a/pkgs/development/libraries/gtk-sharp/builder.sh b/pkgs/development/libraries/gtk-sharp/builder.sh index 73914495d6d..45e640e2a70 100644 --- a/pkgs/development/libraries/gtk-sharp/builder.sh +++ b/pkgs/development/libraries/gtk-sharp/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup genericBuild diff --git a/pkgs/development/libraries/wtk/builder.sh b/pkgs/development/libraries/wtk/builder.sh index c3ad173b093..ca5157c6d71 100644 --- a/pkgs/development/libraries/wtk/builder.sh +++ b/pkgs/development/libraries/wtk/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup mkdir unzipped diff --git a/pkgs/development/perl-modules/generic/builder.sh b/pkgs/development/perl-modules/generic/builder.sh index 110094ad8a4..4da9f7a9821 100644 --- a/pkgs/development/perl-modules/generic/builder.sh +++ b/pkgs/development/perl-modules/generic/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup PERL5LIB="$PERL5LIB${PERL5LIB:+:}$out/lib/perl5/site_perl" diff --git a/pkgs/development/tools/build-managers/boot/builder.sh b/pkgs/development/tools/build-managers/boot/builder.sh index e007cbac958..4506e3f0f86 100644 --- a/pkgs/development/tools/build-managers/boot/builder.sh +++ b/pkgs/development/tools/build-managers/boot/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup boot_bin=$out/bin/boot diff --git a/pkgs/development/tools/misc/automake/builder.sh b/pkgs/development/tools/misc/automake/builder.sh index 0cb1d5d61e3..b08e7251e9e 100644 --- a/pkgs/development/tools/misc/automake/builder.sh +++ b/pkgs/development/tools/misc/automake/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup # Wrap the given `aclocal' program, appending extra `-I' flags diff --git a/pkgs/development/tools/parsing/antlr/builder.sh b/pkgs/development/tools/parsing/antlr/builder.sh index 55259b93212..c1d20845e6b 100644 --- a/pkgs/development/tools/parsing/antlr/builder.sh +++ b/pkgs/development/tools/parsing/antlr/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup tar zxvf $src diff --git a/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh b/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh index bdb52274418..829bc6509e0 100644 --- a/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh +++ b/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup arch=$(uname -m) diff --git a/pkgs/os-specific/linux/nvidia-x11/builder.sh b/pkgs/os-specific/linux/nvidia-x11/builder.sh index b7824f20977..fbb116ab42a 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup unpackManually() { diff --git a/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh b/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh index 34f9b157945..ed2c60da261 100644 --- a/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh +++ b/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup mkdir -p $out/lib diff --git a/pkgs/servers/http/tomcat/axis2/builder.sh b/pkgs/servers/http/tomcat/axis2/builder.sh index d334ab6f927..de8e225456b 100644 --- a/pkgs/servers/http/tomcat/axis2/builder.sh +++ b/pkgs/servers/http/tomcat/axis2/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup unzip $src diff --git a/pkgs/servers/x11/xorg/builder.sh b/pkgs/servers/x11/xorg/builder.sh index a9c607ae35e..833acf43a5b 100644 --- a/pkgs/servers/x11/xorg/builder.sh +++ b/pkgs/servers/x11/xorg/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi # This is the builder for all X.org components. source $stdenv/setup diff --git a/pkgs/stdenv/generic/default-builder.sh b/pkgs/stdenv/generic/default-builder.sh index 8c6fec7873b..d49fb8aa57f 100644 --- a/pkgs/stdenv/generic/default-builder.sh +++ b/pkgs/stdenv/generic/default-builder.sh @@ -1,6 +1,4 @@ -if [ -f .attrs.sh ]; then - . .attrs.sh -fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup genericBuild diff --git a/pkgs/test/simple/builder.sh b/pkgs/test/simple/builder.sh index 908faec3c38..0b09a109bea 100644 --- a/pkgs/test/simple/builder.sh +++ b/pkgs/test/simple/builder.sh @@ -1,4 +1,4 @@ -if [ -e .attrs.sh ]; then source .attrs.sh; fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi set -x export NIX_DEBUG=1 -- cgit 1.4.1 From 1da4b5c99e4a8b85531d38922ce658cef1d7cfcc Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 7 Oct 2023 15:48:15 +0000 Subject: release.nix: namespace bootstrap tools with triples This will allow buliding bootstrap tools for platforms with non-default libcs, like *-unknown-linux-musl. This gets rid of limitedSupportSystems/systemsWithAnySupport. There was no need to use systemsWithAnySupport for supportDarwin, because it was always equivalent to supportedSystems for that purpose, and the only other way it was used was for determining which platforms to build the bootstrap tools for, so we might as well use a more explicit parameter for that, and then we can change how it works without affecting the rest of the Hydra jobs. Not affecting the rest of the Hydra jobs is important, because if we changed all jobs to use config triples, we'd end up renaming every Hydra job. That might still be worth thinking about at some point, but it's unnecessary at this point (and would be a lot of work). I've checked by running nix-eval-jobs --force-recurse pkgs/top-level/release.nix that the actual bootstrap tools derivations are unaffected by this change, and that the only other jobs that change are ones that depend on the hash of all of Nixpkgs. Of the other jobset entrypoints that end up importing pkgs/top-level/release.nix, none used the limitedSupportedSystems parameter, so they should all be unaffected as well. --- maintainers/scripts/all-tarballs.nix | 2 +- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 2 +- pkgs/top-level/release.nix | 27 ++++++++++++++++----------- 3 files changed, 18 insertions(+), 13 deletions(-) (limited to 'pkgs/stdenv') diff --git a/maintainers/scripts/all-tarballs.nix b/maintainers/scripts/all-tarballs.nix index 6a4de8a4b95..83236e6fa91 100644 --- a/maintainers/scripts/all-tarballs.nix +++ b/maintainers/scripts/all-tarballs.nix @@ -12,5 +12,5 @@ import ../../pkgs/top-level/release.nix scrubJobs = false; # No need to evaluate on i686. supportedSystems = [ "x86_64-linux" ]; - limitedSupportedSystems = []; + bootstrapConfigs = []; } diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index 46ba25f8603..448d6ecd9f1 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -211,7 +211,7 @@ in rec { }; bootstrapTools = derivation { - inherit (localSystem) system; + inherit (stdenv.hostPlatform) system; name = "bootstrap-tools"; builder = "${bootstrapFiles.tools}/bin/bash"; diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index ad5f351b9c8..cfd89a89386 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -10,9 +10,16 @@ */ { nixpkgs ? { outPath = (import ../../lib).cleanSource ../..; revCount = 1234; shortRev = "abcdef"; revision = "0000000000000000000000000000000000000000"; } , officialRelease ? false - # The platforms for which we build Nixpkgs. + # The platform doubles for which we build Nixpkgs. , supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] -, limitedSupportedSystems ? [ "i686-linux" ] + # The platform triples for which we build bootstrap tools. +, bootstrapConfigs ? [ + "aarch64-apple-darwin" + "aarch64-unknown-linux-gnu" + "i686-unknown-linux-gnu" + "x86_64-apple-darwin" + "x86_64-unknown-linux-gnu" + ] # Strip most of attributes when evaluating to spare memory usage , scrubJobs ? true # Attributes passed to nixpkgs. Don't build packages marked as unfree. @@ -35,12 +42,10 @@ with import ./release-lib.nix { inherit supportedSystems scrubJobs nixpkgsArgs; let - systemsWithAnySupport = supportedSystems ++ limitedSupportedSystems; - supportDarwin = lib.genAttrs [ "x86_64" "aarch64" - ] (arch: builtins.elem "${arch}-darwin" systemsWithAnySupport); + ] (arch: builtins.elem "${arch}-darwin" supportedSystems); nonPackageJobs = { tarball = import ./make-tarball.nix { inherit pkgs nixpkgs officialRelease supportedSystems; }; @@ -177,21 +182,21 @@ let }; stdenvBootstrapTools = with lib; - genAttrs systemsWithAnySupport (system: - if hasSuffix "-linux" system then + genAttrs bootstrapConfigs (config: + if hasInfix "-linux-" config then let bootstrap = import ../stdenv/linux/make-bootstrap-tools.nix { pkgs = import ../.. { - localSystem = { inherit system; }; + localSystem = { inherit config; }; }; }; in { inherit (bootstrap) dist test; } - else if hasSuffix "-darwin" system then + else if hasSuffix "-darwin" config then let bootstrap = import ../stdenv/darwin/make-bootstrap-tools.nix { - localSystem = { inherit system; }; + localSystem = { inherit config; }; }; in { # Lightweight distribution and test @@ -201,7 +206,7 @@ let #inherit (bootstrap.test-pkgs) stdenv; } else - abort "No bootstrap implementation for system: ${system}" + abort "No bootstrap implementation for system: ${config}" ); }; -- cgit 1.4.1 From 77bf1395d6c5bb99a33c2bf76b2c6943b31ac85b Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 13 Oct 2023 03:35:26 +0300 Subject: mold: add tests for `mold-wrapped` and `useMoldLinker` adapter Make both ready for cross with prefixes Currently `pkgsCross.aarch64-multiplatform.mold.passthru.tests.{wrapped,adapter}` fail with ``` Testing running the 'hello' binary which should be linked with 'mold' Hello, world! Checking for mold in the '.comment' section No mention of 'mold' detected in the '.comment' section The command was: aarch64-unknown-linux-gnu-readelf -p .comment ...bin/hello The output was: String dump of section '.comment': [ 0] GCC: (GNU) 12.3.0 ``` --- pkgs/development/tools/mold/default.nix | 47 ++++++++++++++++++++++++++++++++- pkgs/stdenv/adapters.nix | 4 +-- pkgs/top-level/all-packages.nix | 3 ++- 3 files changed, 50 insertions(+), 4 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/development/tools/mold/default.nix b/pkgs/development/tools/mold/default.nix index 52844300f08..84a7509c528 100644 --- a/pkgs/development/tools/mold/default.nix +++ b/pkgs/development/tools/mold/default.nix @@ -9,6 +9,11 @@ , testers , mold , nix-update-script +, runCommandCC +, mold-wrapped +, hello +, buildPackages +, useMoldLinker }: stdenv.mkDerivation rec { @@ -44,7 +49,47 @@ stdenv.mkDerivation rec { passthru = { updateScript = nix-update-script { }; - tests.version = testers.testVersion { package = mold; }; + tests = + let + helloTest = name: helloMold: + let + command = "$READELF -p .comment ${lib.getExe helloMold}"; + emulator = stdenv.hostPlatform.emulator buildPackages; + in + runCommandCC "mold-${name}-test" { passthru = { inherit helloMold; }; } + '' + echo "Testing running the 'hello' binary which should be linked with 'mold'" >&2 + ${emulator} ${lib.getExe helloMold} + + echo "Checking for mold in the '.comment' section" >&2 + if output=$(${command} 2>&1); then + if grep -Fw -- "mold" - <<< "$output"; then + touch $out + else + echo "No mention of 'mold' detected in the '.comment' section" >&2 + echo "The command was:" >&2 + echo "${command}" >&2 + echo "The output was:" >&2 + echo "$output" >&2 + exit 1 + fi + else + echo -n "${command}" >&2 + echo " returned a non-zero exit code." >&2 + echo "$output" >&2 + exit 1 + fi + '' + ; + in + { + version = testers.testVersion { package = mold; }; + wrapped = helloTest "wrapped" (hello.overrideAttrs (previousAttrs: { + nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [ mold-wrapped ]; + NIX_CFLAGS_LINK = toString (previousAttrs.NIX_CFLAGS_LINK or "") + " -fuse-ld=mold"; + })); + adapter = helloTest "adapter" (hello.override (old: { stdenv = useMoldLinker old.stdenv; })); + }; }; meta = with lib; { diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index f29bdf671c8..9b4ee16a003 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -192,8 +192,8 @@ rec { useMoldLinker = stdenv: let bintools = stdenv.cc.bintools.override { extraBuildCommands = '' - wrap ld.mold ${../build-support/bintools-wrapper/ld-wrapper.sh} ${pkgs.mold}/bin/ld.mold - wrap ld ${../build-support/bintools-wrapper/ld-wrapper.sh} ${pkgs.mold}/bin/ld.mold + wrap ${stdenv.cc.bintools.targetPrefix}ld.mold ${../build-support/bintools-wrapper/ld-wrapper.sh} ${pkgs.mold}/bin/ld.mold + wrap ${stdenv.cc.bintools.targetPrefix}ld ${../build-support/bintools-wrapper/ld-wrapper.sh} ${pkgs.mold}/bin/ld.mold ''; }; in stdenv.override (old: { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a72eef15e85..adfa5861e75 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19650,7 +19650,8 @@ with pkgs; mold-wrapped = wrapBintoolsWith { bintools = mold; extraBuildCommands = '' - wrap mold ${../build-support/bintools-wrapper/ld-wrapper.sh} ${mold}/bin/ld.mold + wrap ${targetPackages.stdenv.cc.bintools.targetPrefix}ld.mold ${../build-support/bintools-wrapper/ld-wrapper.sh} ${mold}/bin/ld.mold + wrap ${targetPackages.stdenv.cc.bintools.targetPrefix}mold ${../build-support/bintools-wrapper/ld-wrapper.sh} ${mold}/bin/mold ''; }; -- cgit 1.4.1 From e64d24fff4042d8ee1def320fee2eb1fd4253532 Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 3 Oct 2023 08:36:22 +0300 Subject: stdenvAdapters.useMoldLinker: automatically add `allowedRequisites` Co-Authored-By: Pavel Sobolev --- pkgs/stdenv/adapters.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 9b4ee16a003..1024bf2ce4d 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -201,7 +201,10 @@ rec { inherit bintools; }; allowedRequisites = - lib.mapNullable (rs: rs ++ [ bintools pkgs.mold (lib.getLib pkgs.mimalloc) (lib.getLib pkgs.openssl) ]) (stdenv.allowedRequisites or null); + (lib.optional (stdenv.allowedRequisites or null != null) stdenv.allowedRequisites) + ++ [ bintools pkgs.mold ] + # need to `outputSpecified = false` to make getLib work + ++ (builtins.map (p: lib.getLib (p // { outputSpecified = false; })) pkgs.mold.buildInputs); # gcc >12.1.0 supports '-fuse-ld=mold' # the wrap ld above in bintools supports gcc <12.1.0 and shouldn't harm >12.1.0 # https://github.com/rui314/mold#how-to-use -- cgit 1.4.1 From df14e86d9cd11b3c6122aa34a41f5af9ec617009 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 13 Oct 2023 18:28:27 -0400 Subject: stdenv.darwin: fix infinite recursion after curl update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit curl needs to link against several frameworks, but building the frameworks (directly or indirectly) depends on curl via fetchurl and fetchFromGitHub. Break the infinite recursion by building the SDKs’ dependencies in the last stage of the stdenv bootstrap using the prior stage’s fetchurl and fetchFromGitHub. --- pkgs/stdenv/darwin/default.nix | 58 ++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 14 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 25a80fd11aa..9ee6dfb1080 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -1047,9 +1047,9 @@ in overrides = self: super: { inherit (prevStage) ccWrapperStdenv - autoconf automake bash bison cmake cmakeMinimal cpio cyrus_sasl db expat flex groff - libedit libtool m4 ninja openldap openssh patchutils pbzx perl pkg-config python3 - python3Minimal scons serf sqlite subversion sysctl texinfo unzip which + autoconf automake bash bison cmake cmakeMinimal cyrus_sasl db expat flex groff + libedit libtool m4 ninja openldap openssh patchutils perl pkg-config python3 scons + serf sqlite subversion sysctl texinfo unzip which # CF dependencies - don’t rebuild them. icu @@ -1057,11 +1057,40 @@ in # LLVM dependencies - don’t rebuild them. libffi libiconv libxml2 ncurses zlib; + # These overrides are required to break an infinite recursion. curl depends on Darwin + # frameworks, but those frameworks require these dependencies to build, which + # depend on curl indirectly. + cpio = super.cpio.override { + inherit (prevStage) fetchurl; + }; + + libyaml = super.libyaml.override { + inherit (prevStage) fetchFromGitHub; + }; + + pbzx = super.pbzx.override { + inherit (prevStage) fetchFromGitHub; + }; + + python3Minimal = super.python3Minimal.override { + inherit (prevStage) fetchurl; + }; + + xar = super.xar.override { + inherit (prevStage) fetchurl; + }; + darwin = super.darwin.overrideScope (selfDarwin: superDarwin: { inherit (prevStage.darwin) dyld CF Libsystem darwin-stubs # CF dependencies - don’t rebuild them. libobjc objc4; + # rewrite-tbd is also needed to build Darwin frameworks, so it’s built using the + # previous stage’s fetchFromGitHub to avoid an infinite recursion (same as above). + rewrite-tbd = superDarwin.rewrite-tbd.override { + inherit (prevStage) fetchFromGitHub; + }; + signingUtils = superDarwin.signingUtils.override { inherit (selfDarwin) sigtool; }; @@ -1158,9 +1187,10 @@ in (prevStage: # previous stage4 stdenv: assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [ - bash binutils-unwrapped brotli bzip2 curl diffutils ed file findutils gawk gettext gmp - gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5 libssh2 - libunistring libxml2 ncurses nghttp2 openbsm openpam openssl patch pcre xz zlib zstd + bash binutils-unwrapped brotli bzip2 cpio curl diffutils ed file findutils gawk + gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5 + libssh2 libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch + pbzx pcre python3Minimal xar xz zlib zstd ]); assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ @@ -1176,9 +1206,9 @@ in ]); assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [ - autoconf automake bison cmake cmakeMinimal cpio cyrus_sasl db expat flex groff libedit - libtool m4 ninja openldap openssh patchutils pbzx perl pkg-config.pkg-config python3 - python3Minimal scons serf sqlite subversion sysctl.provider texinfo unzip which + autoconf automake bison cmake cmakeMinimal cyrus_sasl db expat flex groff libedit + libtool m4 ninja openldap openssh patchutils perl pkg-config.pkg-config python3 scons + serf sqlite subversion sysctl.provider texinfo unzip which ]); assert prevStage.darwin.cctools == prevStage.darwin.cctools-llvm; @@ -1307,14 +1337,14 @@ in overrides = self: super: { inherit (prevStage) - bash binutils brotli bzip2 coreutils curl diffutils ed file findutils gawk gettext - gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libssh2 - libunistring libxml2 ncurses nghttp2 openbsm openpam openssl patch pcre xz zlib - zstd; + bash binutils brotli bzip2 coreutils cpio curl diffutils ed file findutils gawk + gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libssh2 + libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch pbzx + pcre python3Minimal xar xz zlib zstd; darwin = super.darwin.overrideScope (_: _: { inherit (prevStage.darwin) - CF ICU Libsystem darwin-stubs dyld locale libobjc libtapi xnu; + CF ICU Libsystem darwin-stubs dyld locale libobjc libtapi rewrite-tbd xnu; } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { inherit (prevStage.darwin) binutils binutils-unwrapped cctools-llvm cctools-port; }); -- cgit 1.4.1 From 17acba4cd1bb63c174b48a0b7bedb103f08e1eba Mon Sep 17 00:00:00 2001 From: Pavel Sobolev Date: Thu, 19 Oct 2023 15:48:42 +0300 Subject: stdenvAdapters.useMoldLinker: set `allowedRequisites` to `null` --- pkgs/stdenv/adapters.nix | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 1024bf2ce4d..f7d7053c77a 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -197,16 +197,10 @@ rec { ''; }; in stdenv.override (old: { - cc = stdenv.cc.override { - inherit bintools; - }; - allowedRequisites = - (lib.optional (stdenv.allowedRequisites or null != null) stdenv.allowedRequisites) - ++ [ bintools pkgs.mold ] - # need to `outputSpecified = false` to make getLib work - ++ (builtins.map (p: lib.getLib (p // { outputSpecified = false; })) pkgs.mold.buildInputs); - # gcc >12.1.0 supports '-fuse-ld=mold' - # the wrap ld above in bintools supports gcc <12.1.0 and shouldn't harm >12.1.0 + allowedRequisites = null; + cc = stdenv.cc.override { inherit bintools; }; + # gcc >12.1.0 supports '-fuse-ld=mold' + # the wrap ld above in bintools supports gcc <12.1.0 and shouldn't harm >12.1.0 # https://github.com/rui314/mold#how-to-use } // lib.optionalAttrs (stdenv.cc.isClang || (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12")) { mkDerivationFromStdenv = extendMkDerivationArgs old (args: { -- cgit 1.4.1 From e73b7f8d63d2f940ab8110001942b5491d07fd28 Mon Sep 17 00:00:00 2001 From: Niklas Hambüchen Date: Mon, 12 Jun 2023 23:51:59 +0000 Subject: bzip2: Add `enableStatic`. See #61575 --- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 2 +- pkgs/tools/compression/bzip2/default.nix | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index 9c580447a6f..bf6a3fb96a7 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -29,7 +29,7 @@ in rec { cctools_ = darwin.cctools; # Avoid debugging larger changes for now. - bzip2_ = bzip2.override (args: { linkStatic = true; }); + bzip2_ = bzip2.override (args: { enableStatic = true; enableShared = false; }); # Avoid messing with libkrb5 and libnghttp2. curl_ = curlMinimal.override (args: { gssSupport = false; http2Support = false; }); diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix index be456cf5944..bfab2dbb946 100644 --- a/pkgs/tools/compression/bzip2/default.nix +++ b/pkgs/tools/compression/bzip2/default.nix @@ -1,5 +1,6 @@ { lib, stdenv, fetchurl -, linkStatic ? with stdenv.hostPlatform; isStatic || isCygwin +, enableStatic ? with stdenv.hostPlatform; isStatic || isCygwin +, enableShared ? true , autoreconfHook , testers }: @@ -47,8 +48,12 @@ in { outputs = [ "bin" "dev" "out" "man" ]; - configureFlags = - lib.optionals linkStatic [ "--enable-static" "--disable-shared" ]; + configureFlags = lib.concatLists [ + (lib.optional enableStatic "--enable-static") + (lib.optional (!enableShared) "--disable-shared") + ]; + + dontDisableStatic = enableStatic; enableParallelBuilding = true; -- cgit 1.4.1 From 1b3831f1e64ec4c50ced27e52658349ddfad8819 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 21 Oct 2023 00:26:57 +0300 Subject: stdenv: fix typo --- pkgs/stdenv/linux/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 5c03312cc75..35cdb6311df 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -68,7 +68,7 @@ mipsel-linux = import ./bootstrap-files/mipsel-unknown-linux-gnu.nix; mips64el-linux = import (if localSystem.isMips64n32 - then ./bootstrap-files/mips64el-unknown-linux-gnuabin32.nix.nix + then ./bootstrap-files/mips64el-unknown-linux-gnuabin32.nix else ./bootstrap-files/mips64el-unknown-linux-gnuabi64.nix); powerpc64le-linux = import ./bootstrap-files/powerpc64le-unknown-linux-gnu.nix; riscv64-linux = import ./bootstrap-files/riscv64-unknown-linux-gnu.nix; -- cgit 1.4.1 From 87c22100a6892b864ff94476f2965a793d8e4282 Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 14 Sep 2023 16:45:25 +0000 Subject: stdenv.mkDerivation: Reject MD5 hashes While there is no fetcher or builder (in nixpkgs) that takes an `md5` parameter, for some inscrutable reason the nix interpreter accepts the following: ```nix fetchurl { url = "https://www.perdu.com"; hash = "md5-rrdBU2a35b2PM2ZO+n/zGw=="; } ``` Note that neither MD5 nor SHA1 are allowed by the syntax of SRI hashes. --- nixos/doc/manual/release-notes/rl-2311.section.md | 2 ++ pkgs/stdenv/generic/make-derivation.nix | 11 +++++++++++ 2 files changed, 13 insertions(+) (limited to 'pkgs/stdenv') diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index bd0d74a8885..c3cb495498d 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -335,6 +335,8 @@ - `services.kea.{ctrl-agent,dhcp-ddns,dhcp,dhcp6}` now use separate runtime directories instead of `/run/kea` to work around the runtime directory being cleared on service start. +- `mkDerivation` now rejects MD5 hashes. + ## Other Notable Changes {#sec-release-23.11-notable-changes} - The Cinnamon module now enables XDG desktop integration by default. If you are experiencing collisions related to xdg-desktop-portal-gtk you can safely remove `xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];` from your NixOS configuration. diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index beba687e788..d235ffefaab 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -165,6 +165,17 @@ let , ... } @ attrs: +# Policy on acceptable hash types in nixpkgs +assert attrs ? outputHash -> ( + let algo = + attrs.outputHashAlgo or (lib.head (lib.splitString "-" attrs.outputHash)); + in + if algo == "md5" then + throw "Rejected insecure ${algo} hash '${attrs.outputHash}'" + else + true +); + let # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when # no package has `doCheck = true`. -- cgit 1.4.1 From c2a623b52a1f10dfcda9642217eac39502ecbf26 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 26 Oct 2023 01:04:35 -0400 Subject: stdenvAdapters: add overrideSDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a replacement for using `darwin.apple_sdk_.callPackage`. Instead of injecting the required packages, it provides a stdenv adapter that modifies the derivation’s build inputs to use the requested SDK versions. This modification extends to any build inputs propagated to it as well. The `callPackage` approach is not deprecated yet, but it is expected that it will be eventually. Note that this is an MVP. It should work with most packages, but it only handles build inputs and also only handles frameworks. Once more SDKs are added (after #229210 is merged) and the SDK structure is normalized, it can be extended to handle any package in the SDK namespace. Cross-compilation may or may not work. Any cross-related issues can be addressed after #256590 is merged. --- pkgs/stdenv/adapters.nix | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 7c64fd7e392..a7985b474ed 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -246,4 +246,103 @@ rec { env = (args.env or {}) // { NIX_CFLAGS_COMPILE = toString (args.env.NIX_CFLAGS_COMPILE or "") + " ${toString compilerFlags}"; }; }); }); + + # Overriding the SDK changes the Darwin SDK used to build the package, which: + # * Ensures that the compiler and bintools have the correct Libsystem version; and + # * Replaces any SDK references with those in the SDK corresponding to the requested SDK version. + # + # `sdkVersion` can be any of the following: + # * A version string indicating the requested SDK version; or + # * An attrset consisting of either or both of the following fields: darwinSdkVersion and darwinMinVersion. + overrideSDK = stdenv: sdkVersion: + let + inherit ( + { inherit (stdenv.hostPlatform) darwinMinVersion darwinSdkVersion; } + // (if lib.isAttrs sdkVersion then sdkVersion else { darwinSdkVersion = sdkVersion; }) + ) darwinMinVersion darwinSdkVersion; + + sdk = pkgs.darwin."apple_sdk_${lib.replaceStrings [ "." ] [ "_" ] darwinSdkVersion}"; + + isSDKFramework = pkg: lib.hasPrefix "apple-framework-" (lib.getName pkg); + + replacePropagatedFrameworks = pkg: + let + propagatedFrameworks = lib.filter isSDKFramework pkg.propagatedBuildInputs; + env = { + inherit (pkg) outputs; + # Map the old frameworks to new and the package’s outputs to their original outPaths. + # The mappings are rendered into tab-separated files to be read back with `read`. + frameworks = lib.concatMapStrings (pkg: "${pkg}\t${mapPackageToSDK pkg}\n") propagatedFrameworks; + pkgOutputs = lib.concatMapStrings (output: "${output}\t${(lib.getOutput output pkg).outPath}\n") pkg.outputs; + passAsFile = [ "frameworks" "pkgOutputs" ]; + }; + in + if lib.length propagatedFrameworks > 0 + then pkgs.runCommand pkg.name env '' + # Iterate over the outputs in the package being replaced to make sure the proxy is + # a fully functional replacement. This is like `symlinkJoin` except for outputs and + # the contents of `nix-support`, which will be customized for the requested SDK. + while IFS=$'\t\n' read -r outputName pkgOutputPath; do + mkdir -p "''${!outputName}" + + for targetPath in "$pkgOutputPath"/*; do + targetName=$(basename "$targetPath") + + # `nix-support` is special-cased because any propagated inputs need their SDK + # frameworks replaced with those from the requested SDK. + if [ "$targetName" == "nix-support" ]; then + mkdir "''${!outputName}/nix-support" + + for file in "$targetPath"/*; do + fileName=$(basename "$file") + + if [ "$fileName" == "propagated-build-inputs" ]; then + cp "$file" "''${!outputName}/nix-support/$fileName" + + while IFS=$'\t\n' read -r oldFramework newFramework; do + substituteInPlace "''${!outputName}/nix-support/$fileName" \ + --replace "$oldFramework" "$newFramework" + done < "$frameworksPath" + fi + done + else + ln -s "$targetPath" "''${!outputName}/$targetName" + fi + done + done < "$pkgOutputsPath" + '' + else pkg; + + # Remap a framework from one SDK version to another. + mapPackageToSDK = pkg: + let + name = lib.getName pkg; + framework = lib.removePrefix "apple-framework-" name; + in + if isSDKFramework pkg + then sdk.frameworks."${framework}" + else replacePropagatedFrameworks pkg; + + mapInputsToSDK = inputs: args: + lib.genAttrs inputs (input: map mapPackageToSDK (args."${input}" or [ ])); + + mkCC = cc: cc.override { + bintools = cc.bintools.override { libc = sdk.Libsystem; }; + libc = sdk.Libsystem; + }; + in + # TODO: make this work across all input types and not just propagatedBuildInputs + stdenv.override (old: { + buildPlatform = old.buildPlatform // { inherit darwinMinVersion darwinSdkVersion; }; + hostPlatform = old.hostPlatform // { inherit darwinMinVersion darwinSdkVersion; }; + targetPlatform = old.targetPlatform // { inherit darwinMinVersion darwinSdkVersion; }; + + allowedRequisites = null; + cc = mkCC old.cc; + + extraBuildInputs = [sdk.frameworks.CoreFoundation ]; + mkDerivationFromStdenv = extendMkDerivationArgs old (mapInputsToSDK [ + "buildInputs" + ]); + }); } -- cgit 1.4.1 From 3440df992e8ae2ae592b4359064765811e1ad2bd Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 31 Oct 2023 00:14:59 -0400 Subject: stdenvAdapters.overrideSDK: override xcodebuild to use the requested SDK --- pkgs/stdenv/adapters.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index a7985b474ed..dd3dcfd6f3a 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -323,8 +323,27 @@ rec { then sdk.frameworks."${framework}" else replacePropagatedFrameworks pkg; + mapRuntimeToSDK = pkg: + # Only remap xcbuild for now, which exports the SDK used to build it. + if pkg != null && lib.getName pkg == "xcodebuild" + then pkg.override { stdenv = overrideSDK stdenv { inherit darwinMinVersion darwinSdkVersion; }; } + else pkg; + mapInputsToSDK = inputs: args: - lib.genAttrs inputs (input: map mapPackageToSDK (args."${input}" or [ ])); + let + runsAtBuild = lib.flip lib.elem [ + "depsBuildBuild" + "depsBuildBuildPropagated" + "nativeBuildInputs" + "propagatedNativeBuildInputs" + "depsBuildTarget" + "depsBuildTargetPropagated" + ]; + atBuildInputs = lib.filter runsAtBuild inputs; + atRuntimeInputs = lib.subtractLists atBuildInputs inputs; + in + lib.genAttrs atRuntimeInputs (input: map mapPackageToSDK (args."${input}" or [ ])) + // lib.genAttrs atBuildInputs (input: map mapRuntimeToSDK (args."${input}" or [ ])); mkCC = cc: cc.override { bintools = cc.bintools.override { libc = sdk.Libsystem; }; @@ -343,6 +362,8 @@ rec { extraBuildInputs = [sdk.frameworks.CoreFoundation ]; mkDerivationFromStdenv = extendMkDerivationArgs old (mapInputsToSDK [ "buildInputs" + "nativeBuildInputs" + "propagatedNativeBuildInputs" ]); }); } -- cgit 1.4.1 From e143a933f67eeaadc6aeaf56740bcf040f89b31f Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 31 Oct 2023 12:37:14 +0100 Subject: check-meta.nix: Fix flake note - These new-cli commands can be used with `-f`, in which case they're evaluated with pure evaluation disabled. - Nix 2.4+ is not part of the condition; "flakes" is fully descriptive and more relatable. - Don't suggest that it only enables this variable. - Just don't say too much. --- pkgs/stdenv/generic/check-meta.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 63fd00d266e..9a794531bc1 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -152,9 +152,8 @@ let # flakeNote will be printed in the remediation messages below. flakeNote = " - Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+ - (Flake) command, `--impure` must be passed in order to read this - environment variable. + Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake, + then pass `--impure` in order to allow use of environment variables. "; remediate_allowlist = allow_attr: rebuild_amendment: attrs: -- cgit 1.4.1 From 50d046c32a1924066b87392d8b2ebb14e509e65c Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 27 Oct 2023 20:19:11 -0400 Subject: stdenvAdapters.overrideSDK: update the SDK version recursively Update all propagated build inputs recursively, so that propagated inputs with propagated inputs use the correct SDK. --- pkgs/stdenv/adapters.nix | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index dd3dcfd6f3a..9230ce071c3 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -263,21 +263,24 @@ rec { sdk = pkgs.darwin."apple_sdk_${lib.replaceStrings [ "." ] [ "_" ] darwinSdkVersion}"; - isSDKFramework = pkg: lib.hasPrefix "apple-framework-" (lib.getName pkg); - replacePropagatedFrameworks = pkg: let - propagatedFrameworks = lib.filter isSDKFramework pkg.propagatedBuildInputs; + propagatedInputs = pkg.propagatedBuildInputs; + mappedInputs = map mapPackageToSDK propagatedInputs; + env = { inherit (pkg) outputs; - # Map the old frameworks to new and the package’s outputs to their original outPaths. - # The mappings are rendered into tab-separated files to be read back with `read`. - frameworks = lib.concatMapStrings (pkg: "${pkg}\t${mapPackageToSDK pkg}\n") propagatedFrameworks; + # Map old frameworks to new ones and the package’s outputs to their original outPaths. + # Also map any packages that have propagated frameworks to their proxy packages using + # the requested SDK version. These mappings are rendered into tab-separated files to be + # parsed and read back with `read`. + dependencies = lib.concatMapStrings (pair: "${pair.fst}\t${pair.snd}\n") (lib.zipLists propagatedInputs mappedInputs); pkgOutputs = lib.concatMapStrings (output: "${output}\t${(lib.getOutput output pkg).outPath}\n") pkg.outputs; - passAsFile = [ "frameworks" "pkgOutputs" ]; + passAsFile = [ "dependencies" "pkgOutputs" ]; }; in - if lib.length propagatedFrameworks > 0 + # Only remap the package’s propagated inputs if there are any and if any of them were themselves remapped. + if lib.length propagatedInputs > 0 && propagatedInputs != mappedInputs then pkgs.runCommand pkg.name env '' # Iterate over the outputs in the package being replaced to make sure the proxy is # a fully functional replacement. This is like `symlinkJoin` except for outputs and @@ -302,7 +305,7 @@ rec { while IFS=$'\t\n' read -r oldFramework newFramework; do substituteInPlace "''${!outputName}/nix-support/$fileName" \ --replace "$oldFramework" "$newFramework" - done < "$frameworksPath" + done < "$dependenciesPath" fi done else @@ -319,9 +322,9 @@ rec { name = lib.getName pkg; framework = lib.removePrefix "apple-framework-" name; in - if isSDKFramework pkg - then sdk.frameworks."${framework}" - else replacePropagatedFrameworks pkg; + /**/ if pkg == null then pkg + else if name != framework then sdk.frameworks."${framework}" + else replacePropagatedFrameworks pkg; mapRuntimeToSDK = pkg: # Only remap xcbuild for now, which exports the SDK used to build it. -- cgit 1.4.1 From b6a14a3a848618f9016bd310eff2f7bcf44f1557 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 27 Oct 2023 20:47:37 -0400 Subject: stdenvAdapters.overrideSDK: also remap propagatedBuildInputs --- pkgs/stdenv/adapters.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 9230ce071c3..9931445ce56 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -367,6 +367,7 @@ rec { "buildInputs" "nativeBuildInputs" "propagatedNativeBuildInputs" + "propagatedBuildInputs" ]); }); } -- cgit 1.4.1 From 08e1c95e9c62b966a44cf435abf6bf62553bf950 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 1 Nov 2023 12:27:31 -0400 Subject: stdenvAdapters.overrideSDK: handle non-drv nativeBuildInputs --- pkgs/stdenv/adapters.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 9931445ce56..977ef2eef9c 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -328,7 +328,7 @@ rec { mapRuntimeToSDK = pkg: # Only remap xcbuild for now, which exports the SDK used to build it. - if pkg != null && lib.getName pkg == "xcodebuild" + if pkg != null && lib.isAttrs pkg && lib.getName pkg == "xcodebuild" then pkg.override { stdenv = overrideSDK stdenv { inherit darwinMinVersion darwinSdkVersion; }; } else pkg; -- cgit 1.4.1 From daa79a1d2db7909a314bb8aa0adf514147a1191e Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 1 Nov 2023 20:56:50 -0400 Subject: darwin.stdenv: use CoreFoundation instead of CF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch switches the CoreFoundation on x86_64-darwin from the open source swift-corelibs-foundation (CF) to the system CoreFoundation. This change was motivated by failures building packages for the current staging-next cycle #263535 due to an apparent incompatibility with the rpath-based approach to choosing CF or CoreFoundation and macOS 14. This error often manifests as a crash with an Illegal Instruction. For example, building aws-sdk-cpp for building Nix will fail this way. https://hydra.nixos.org/build/239459417/nixlog/1 Application Specific Information: CF objects must have a non-zero isa Error Formulating Crash Report: PC register does not match crashing frame (0x0 vs 0x7FF8094DD640) Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 CoreFoundation 0x7ff8094dd640 CF_IS_OBJC.cold.1 + 14 1 CoreFoundation 0x7ff8094501d0 CF_IS_OBJC + 60 2 CoreFoundation 0x7ff8093155e8 CFRelease + 40 3 ??? 0x10c7a2c61 s_aws_secure_transport_ctx_destroy + 65 4 ??? 0x10c87ba32 aws_ref_count_release + 34 5 ??? 0x10c7b7adb aws_tls_connection_options_clean_up + 27 6 ??? 0x10c596db4 Aws::Crt::Io::TlsConnectionOptions::~TlsConnectionOptions() + 20 7 ??? 0x10c2d249c Aws::CleanupCrt() + 92 8 ??? 0x10c2d1ff0 Aws::ShutdownAPI(Aws::SDKOptions const&) + 64 9 ??? 0x102d9bc6f main + 335 10 dyld 0x202f333a6 start + 1942 According to a [post][1] on the Apple developer forums, hardening was added to CoreFoundation, and this particular message occurs when you attempt to release an object it does not recognize as a valid CF object. (Thank you to @lilyinstarlight for finding this post). When I switched aws-sdk-cpp to link against CoreFoundation instead of CF, the error went away. Somehow both libraries were being used. To prevent dependent packages from linking the wrong CoreFoundation, it would need to be added as a propagated build input. Note that there are other issues related to mixing CF and CoreFoundation frameworks. #264503 fixes an issue with abseil-cpp where it propagates CF, causing issues when using a different SDK version. Mixing versions can also cause crashes with Python when a shared object is loaded that is linked to the “wrong” CoreFoundation. `NIX_COREFOUNDATION_RPATH` is supposed to make sure the right CoreFoundation is being used, but it does not appear to be enough on macOS 14 (presumably due to the hardening). While it is possible to propagate CoreFoundation manually, the cleaner solution is to make it the default. CF remains available as `darwin.swift-corelibs-foundation`. [1]: https://developer.apple.com/forums/thread/739355 --- pkgs/stdenv/darwin/default.nix | 65 ++++++++++++++++++++++++-------------- pkgs/top-level/darwin-packages.nix | 43 +++++++++++++------------ 2 files changed, 65 insertions(+), 43 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 9ee6dfb1080..c94c56daae1 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -245,7 +245,8 @@ in coreutils = bootstrapTools; gnugrep = bootstrapTools; - pbzx = bootstrapTools; + # Either pbzx or Libsystem is required from bootstrap tools (one is used building the other). + pbzx = if localSystem.isAarch64 then bootstrapTools else super.pbzx; cpio = self.stdenv.mkDerivation { name = "bootstrap-stage0-cpio"; buildCommand = '' @@ -255,7 +256,11 @@ in passthru.isFromBootstrapFiles = true; }; - darwin = super.darwin.overrideScope (selfDarwin: _: { + darwin = super.darwin.overrideScope (selfDarwin: superDarwin: { + # Prevent CF from being propagated to the initial stdenv. Packages that require it + # will have to manually add it to their build inputs. + CF = null; + binutils-unwrapped = bootstrapTools // { version = "boot"; }; @@ -296,15 +301,6 @@ in sigtool = bootstrapTools; } // lib.optionalAttrs (! useAppleSDKLibs) { - CF = self.stdenv.mkDerivation { - name = "bootstrap-stage0-CF"; - buildCommand = '' - mkdir -p $out/Library/Frameworks - ln -s ${bootstrapTools}/Library/Frameworks/CoreFoundation.framework $out/Library/Frameworks - ''; - passthru.isFromBootstrapFiles = true; - }; - Libsystem = self.stdenv.mkDerivation { name = "bootstrap-stage0-Libsystem"; buildCommand = '' @@ -424,15 +420,18 @@ in # making sure both packages are present on x86_64-darwin and aarch64-darwin. (prevStage: # previous stage0 stdenv: - assert lib.all isFromBootstrapFiles (with prevStage; [ bash coreutils cpio gnugrep pbzx ]); + assert lib.all isFromBootstrapFiles ( + with prevStage; [ bash coreutils cpio gnugrep ] ++ lib.optionals useAppleSDKLibs [ pbzx ] + ); assert lib.all isFromBootstrapFiles (with prevStage.darwin; [ binutils-unwrapped cctools print-reexports rewrite-tbd sigtool ]); - assert (! useAppleSDKLibs) -> lib.all isFromBootstrapFiles (with prevStage.darwin; [ CF Libsystem ]); - assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem ]); + assert (! useAppleSDKLibs) -> lib.all isFromBootstrapFiles (with prevStage.darwin; [ Libsystem ]); + assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ Libsystem ]); assert lib.all isFromNixpkgs (with prevStage.darwin; [ dyld launchd xnu ]); + assert (with prevStage.darwin; (! useAppleSDKLibs) -> CF == null); assert lib.all isFromBootstrapFiles (with prevStage.llvmPackages; [ clang-unwrapped libclang libllvm llvm compiler-rt libcxx libcxxabi @@ -445,7 +444,11 @@ in inherit (prevStage) ccWrapperStdenv coreutils gnugrep; - cmake = super.cmakeMinimal; + # Use this stage’s CF to build CMake. It’s required but can’t be included in the stdenv. + cmake = self.cmakeMinimal; + cmakeMinimal = super.cmakeMinimal.overrideAttrs (old: { + buildInputs = old.buildInputs ++ [ self.darwin.CF ]; + }); curl = super.curlMinimal; @@ -457,9 +460,18 @@ in ninja = super.ninja.override { buildDocs = false; }; - python3 = super.python3Minimal; + # Use this stage’s CF to build Python. It’s required but can’t be included in the stdenv. + python3 = self.python3Minimal; + python3Minimal = super.python3Minimal.overrideAttrs (old: { + buildInputs = old.buildInputs ++ [ self.darwin.CF ]; + }); darwin = super.darwin.overrideScope (selfDarwin: superDarwin: { + # Use this stage’s CF to build configd. It’s required but can’t be included in the stdenv. + configd = superDarwin.configd.overrideAttrs (old: { + buildInputs = old.buildInputs or [ ] ++ [ self.darwin.CF ]; + }); + signingUtils = prevStage.darwin.signingUtils.override { inherit (selfDarwin) sigtool; }; @@ -529,7 +541,8 @@ in assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ binutils-unwrapped cctools locale libtapi print-reexports rewrite-tbd sigtool ]); - assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ CF Libsystem configd ]); + assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ Libsystem configd ]); + assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem libobjc]); assert lib.all isFromNixpkgs (with prevStage.darwin; [ dyld launchd xnu ]); @@ -628,7 +641,8 @@ in binutils-unwrapped cctools locale libtapi print-reexports rewrite-tbd sigtool ]); - assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ CF Libsystem configd ]); + assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ Libsystem configd ]); + assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem libobjc ]); assert lib.all isFromNixpkgs (with prevStage.darwin; [ dyld launchd xnu ]); @@ -725,7 +739,8 @@ in binutils-unwrapped cctools locale libtapi print-reexports rewrite-tbd sigtool ]); - assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ CF Libsystem configd ]); + assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ Libsystem configd ]); + assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem libobjc ]); assert lib.all isFromNixpkgs (with prevStage.darwin; [ dyld launchd libclosure libdispatch xnu ]); @@ -824,8 +839,9 @@ in binutils-unwrapped cctools locale libtapi print-reexports rewrite-tbd sigtool ]); - assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ CF configd ]); + assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ configd ]); assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem ]); + assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem libobjc ]); assert lib.all isFromNixpkgs (with prevStage.darwin; [ dyld launchd libclosure libdispatch xnu ]); @@ -951,7 +967,8 @@ in ]); assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ configd ]); - assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ CF Libsystem ]); + assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem ]); + assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem libobjc ]); assert lib.all isFromNixpkgs (with prevStage.darwin; [ dyld launchd libclosure libdispatch xnu ]); @@ -1031,7 +1048,8 @@ in ]); assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ configd ]); - assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ CF Libsystem ]); + assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem ]); + assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem libobjc ]); assert lib.all isFromNixpkgs (with prevStage.darwin; [ dyld launchd libclosure libdispatch xnu ]); @@ -1197,7 +1215,8 @@ in binutils-unwrapped cctools libtapi locale print-reexports rewrite-tbd sigtool ]); - assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ CF Libsystem configd ]); + assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem configd ]); + assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem libobjc ]); assert lib.all isFromNixpkgs (with prevStage.darwin; [ dyld launchd libclosure libdispatch xnu ]); diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 435687279c7..2547b0c81cc 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -200,26 +200,29 @@ impure-cmds // appleSourcePackages // chooseLibs // { CoreSymbolication = callPackage ../os-specific/darwin/CoreSymbolication { }; - # TODO: make swift-corefoundation build with apple_sdk_11_0.Libsystem - CF = if useAppleSDKLibs - then - # This attribute (CF) is included in extraBuildInputs in the stdenv. This - # is typically the open source project. When a project refers to - # "CoreFoundation" it has an extra setup hook to force impure system - # CoreFoundation into the link step. - # - # In this branch, we only have a single "CoreFoundation" to choose from. - # To be compatible with the existing convention, we define - # CoreFoundation with the setup hook, and CF as the same package but - # with the setup hook removed. - # - # This may seem unimportant, but without it packages (e.g., bacula) will - # fail with linker errors referring ___CFConstantStringClassReference. - # It's not clear to me why some packages need this extra setup. - lib.overrideDerivation apple_sdk.frameworks.CoreFoundation (drv: { - setupHook = null; - }) - else callPackage ../os-specific/darwin/swift-corelibs/corefoundation.nix { }; + # TODO: Remove the CF hook if a solution to the crashes is not found. + CF = + # CF used to refer to the open source version of CoreFoundation from the Swift + # project. As of macOS 14, the rpath-based approach allowing packages to choose + # which version to use no longer seems to work reliably. Sometimes they works, + # but sometimes they crash with the error (in the system crash logs): + # CF objects must have a non-zero isa. + # See https://developer.apple.com/forums/thread/739355 for more on that error. + # + # In this branch, we only have a single "CoreFoundation" to choose from. + # To be compatible with the existing convention, we define + # CoreFoundation with the setup hook, and CF as the same package but + # with the setup hook removed. + # + # This may seem unimportant, but without it packages (e.g., bacula) will + # fail with linker errors referring ___CFConstantStringClassReference. + # It's not clear to me why some packages need this extra setup. + lib.overrideDerivation apple_sdk.frameworks.CoreFoundation (drv: { + setupHook = null; + }); + + # Formerly the CF attribute. Use this is you need the open source release. + swift-corelibs-foundation = callPackage ../os-specific/darwin/swift-corelibs/corefoundation.nix { }; # As the name says, this is broken, but I don't want to lose it since it's a direction we want to go in # libdispatch-broken = callPackage ../os-specific/darwin/swift-corelibs/libdispatch.nix { }; -- cgit 1.4.1 From cc4fcc147b644cb97ff47d97af3045ee1889080c Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 3 Nov 2023 23:02:26 -0400 Subject: stdenvAdapters: add overrideLibcxx This was taken from #264091 to use in the interim before that PR lands (sometime after the release of 23.11). It allows different versions of clang to link the same libc++, allowing dependencies to be linked when they are built with a different version of clang than the stdenv. --- pkgs/stdenv/adapters.nix | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 977ef2eef9c..5fd59a550cb 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -42,6 +42,50 @@ rec { stdenv.override (prev: { allowedRequisites = null; extraBuildInputs = (prev.extraBuildInputs or []) ++ pkgs; }); + # Override the libc++ dynamic library used in the stdenv to use the one from the platform’s + # default stdenv. This allows building packages and linking dependencies with different + # compiler versions while still using the same libc++ implementation for compatibility. + # + # Note that this adapter still uses the headers from the new stdenv’s libc++. This is necessary + # because older compilers may not be able to parse the headers from the default stdenv’s libc++. + overrideLibcxx = stdenv: + assert stdenv.cc.libcxx != null; + let + llvmLibcxxVersion = lib.getVersion llvmLibcxx; + stdenvLibcxxVersion = lib.getVersion stdenvLibcxx; + + stdenvLibcxx = pkgs.stdenv.cc.libcxx; + stdenvCxxabi = pkgs.stdenv.cc.libcxx.cxxabi; + + llvmLibcxx = stdenv.cc.libcxx; + llvmCxxabi = stdenv.cc.libcxx.cxxabi; + + libcxx = pkgs.runCommand "${stdenvLibcxx.name}-${llvmLibcxxVersion}" { + outputs = [ "out" "dev" ]; + inherit cxxabi; + isLLVM = true; + } '' + mkdir -p "$dev/nix-support" + ln -s '${stdenvLibcxx}' "$out" + echo '${stdenvLibcxx}' > "$dev/nix-support/propagated-build-inputs" + ln -s '${lib.getDev llvmLibcxx}/include' "$dev/include" + ''; + + cxxabi = pkgs.runCommand "${stdenvCxxabi.name}-${llvmLibcxxVersion}" { + outputs = [ "out" "dev" ]; + inherit (stdenvCxxabi) libName; + } '' + mkdir -p "$dev/nix-support" + ln -s '${stdenvCxxabi}' "$out" + echo '${stdenvCxxabi}' > "$dev/nix-support/propagated-build-inputs" + ln -s '${lib.getDev llvmCxxabi}/include' "$dev/include" + ''; + in + overrideCC stdenv (stdenv.cc.override { + inherit libcxx; + extraPackages = [ cxxabi pkgs.pkgsTargetTarget."llvmPackages_${lib.versions.major llvmLibcxxVersion}".compiler-rt ]; + }); + # Override the setup script of stdenv. Useful for testing new # versions of the setup script without causing a rebuild of # everything. -- cgit 1.4.1 From 98b8d3474bffdf42b178fad2bc4f804f1227f118 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 4 Nov 2023 01:43:16 -0400 Subject: stdenvAdapters.overrideSDK: special case the 10.12 Libsystem The 10.12 Libsystem is not located as a sub-attribute of `darwin.apple_sdk_10_12`. This will be fixed as part of the SDK changes planned for post-23.11. In the meantime, special case it so the adapter can be used to change the deployment target. --- pkgs/stdenv/adapters.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 977ef2eef9c..a6a2736fec1 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -262,6 +262,9 @@ rec { ) darwinMinVersion darwinSdkVersion; sdk = pkgs.darwin."apple_sdk_${lib.replaceStrings [ "." ] [ "_" ] darwinSdkVersion}"; + # TODO: Make this unconditional after #229210 has been merged, + # and the 10.12 SDK is updated to follow the new structure. + Libsystem = if darwinSdkVersion == "10.12" then pkgs.darwin.Libsystem else sdk.Libsystem; replacePropagatedFrameworks = pkg: let @@ -349,8 +352,8 @@ rec { // lib.genAttrs atBuildInputs (input: map mapRuntimeToSDK (args."${input}" or [ ])); mkCC = cc: cc.override { - bintools = cc.bintools.override { libc = sdk.Libsystem; }; - libc = sdk.Libsystem; + bintools = cc.bintools.override { libc = Libsystem; }; + libc = Libsystem; }; in # TODO: make this work across all input types and not just propagatedBuildInputs -- cgit 1.4.1 From 707a5c09db955f8435f26377df9a543a660035ed Mon Sep 17 00:00:00 2001 From: mlatus Date: Sun, 7 May 2023 01:17:14 -0700 Subject: stdenv: wrap phase running actions of genericBuild Provide a `runPhase` function which wraps the phase running action of genericBuild. The new function can be used as an interface by `nix develop`, i.e. `nix develop some#flake --build` may just call `runPhase build`, which makes its behavior more consistent with `nix build`. In preparation of fixing https://github.com/NixOS/nix/issues/6202 --- pkgs/stdenv/generic/setup.sh | 72 ++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 33 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index ad9857fc9d6..aa2ff8578f4 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1539,6 +1539,44 @@ showPhaseFooter() { } +runPhase() { + local curPhase="$*" + if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then return; fi + if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then return; fi + if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then return; fi + if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then return; fi + if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then return; fi + if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then return; fi + if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then return; fi + if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then return; fi + if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then return; fi + + if [[ -n $NIX_LOG_FD ]]; then + echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" >&"$NIX_LOG_FD" + fi + + showPhaseHeader "$curPhase" + dumpVars + + local startTime=$(date +"%s") + + # Evaluate the variable named $curPhase if it exists, otherwise the + # function named $curPhase. + eval "${!curPhase:-$curPhase}" + + local endTime=$(date +"%s") + + showPhaseFooter "$curPhase" "$startTime" "$endTime" + + if [ "$curPhase" = unpackPhase ]; then + # make sure we can cd into the directory + [ -n "${sourceRoot:-}" ] && chmod +x "${sourceRoot}" + + cd "${sourceRoot:-.}" + fi +} + + genericBuild() { # variable used by our gzip wrapper to add -n. # gzip is in common-path.nix and is added to nix-shell but we only want to change its behaviour in nix builds. do not move to a setupHook in gzip. @@ -1565,39 +1603,7 @@ genericBuild() { # phase name is space-free, which it must be because it's the name # of either a shell variable or a shell function. for curPhase in ${phases[*]}; do - if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then continue; fi - if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then continue; fi - if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then continue; fi - if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then continue; fi - if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then continue; fi - if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then continue; fi - if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then continue; fi - if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then continue; fi - if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then continue; fi - - if [[ -n $NIX_LOG_FD ]]; then - echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" >&"$NIX_LOG_FD" - fi - - showPhaseHeader "$curPhase" - dumpVars - - local startTime=$(date +"%s") - - # Evaluate the variable named $curPhase if it exists, otherwise the - # function named $curPhase. - eval "${!curPhase:-$curPhase}" - - local endTime=$(date +"%s") - - showPhaseFooter "$curPhase" "$startTime" "$endTime" - - if [ "$curPhase" = unpackPhase ]; then - # make sure we can cd into the directory - [ -n "${sourceRoot:-}" ] && chmod +x "${sourceRoot}" - - cd "${sourceRoot:-.}" - fi + runPhase "$curPhase" done } -- cgit 1.4.1 From 506dcaabb4e004ed5db214f7efbbc278e89f6212 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 9 May 2023 13:43:23 +0000 Subject: stdenv: fix meson rust cross compilation --- pkgs/desktops/gnome/core/gnome-tour/default.nix | 11 ----------- pkgs/development/libraries/gstreamer/rs/default.nix | 10 +--------- pkgs/stdenv/generic/make-derivation.nix | 2 ++ 3 files changed, 3 insertions(+), 20 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/desktops/gnome/core/gnome-tour/default.nix b/pkgs/desktops/gnome/core/gnome-tour/default.nix index 26ac73f546d..bb658fcd448 100644 --- a/pkgs/desktops/gnome/core/gnome-tour/default.nix +++ b/pkgs/desktops/gnome/core/gnome-tour/default.nix @@ -17,7 +17,6 @@ , libadwaita , librsvg , rustc -, writeText , cargo }: @@ -59,16 +58,6 @@ stdenv.mkDerivation rec { librsvg ]; - mesonFlags = - let - # ERROR: 'rust' compiler binary not defined in cross or native file - crossFile = writeText "cross-file.conf" '' - [binaries] - rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ] - ''; - in - lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ]; - passthru = { updateScript = gnome.updateScript { packageName = pname; diff --git a/pkgs/development/libraries/gstreamer/rs/default.nix b/pkgs/development/libraries/gstreamer/rs/default.nix index 1d06f880959..ee467f965c8 100644 --- a/pkgs/development/libraries/gstreamer/rs/default.nix +++ b/pkgs/development/libraries/gstreamer/rs/default.nix @@ -2,7 +2,6 @@ , stdenv , fetchFromGitLab , fetchpatch -, writeText , rustPlatform , meson , ninja @@ -204,14 +203,7 @@ stdenv.mkDerivation rec { ) ++ [ (lib.mesonOption "sodium-source" "system") (lib.mesonEnable "doc" enableDocumentation) - ] ++ (let - crossFile = writeText "cross-file.conf" '' - [binaries] - rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ] - ''; - in lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ - "--cross-file=${crossFile}" - ]); + ]; # turn off all auto plugins since we use a list of plugins we generate mesonAutoFeatures = "disabled"; diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index d235ffefaab..bd0d85fc676 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -402,6 +402,7 @@ else let crossFile = builtins.toFile "cross-file.conf" '' [properties] + bindgen_clang_arguments = ['-target', '${stdenv.targetPlatform.config}'] needs_exe_wrapper = ${lib.boolToString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)} [host_machine] @@ -412,6 +413,7 @@ else let [binaries] llvm-config = 'llvm-config-native' + rust = ['rustc', '--target', '${stdenv.targetPlatform.rust.rustcTargetSpec}'] ''; crossFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ]; in crossFlags ++ mesonFlags; -- cgit 1.4.1 From c3c31aa798551a2808981d14537d04de8f51dff8 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 11 Nov 2023 19:15:20 +0200 Subject: stdenv: Improve performance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit | stat | before | after | Δ | Δ% | |------------------------|-----------------|-----------------|-----------------|---------| | cpuTime | 513.67 | 507.77 | ↘ 5.90 | -1.15% | | envs-bytes | 20,682,847,968 | 20,628,961,616 | ↘ 53,886,352 | -0.26% | | envs-elements | 1,054,735,104 | 1,051,395,620 | ↘ 3,339,484 | -0.32% | | envs-number | 765,310,446 | 763,612,291 | ↘ 1,698,155 | -0.22% | | gc-heapSize | 53,439,602,688 | 51,711,545,344 | ↘ 1,728,057,344 | -3.23% | | gc-totalBytes | 113,062,066,672 | 112,139,998,240 | ↘ 922,068,432 | -0.82% | | list-bytes | 3,118,249,784 | 3,118,249,784 | 0 | | | list-concats | 52,834,140 | 52,834,140 | 0 | | | list-elements | 389,781,223 | 389,781,223 | 0 | | | nrAvoided | 968,097,988 | 991,889,795 | ↗ 23,791,807 | 2.46% | | nrFunctionCalls | 697,259,792 | 697,259,792 | 0 | | | nrLookups | 510,257,062 | 338,275,331 | ↘ 171,981,731 | -33.70% | | nrOpUpdateValuesCopied | 1,446,690,216 | 1,446,690,216 | 0 | | | nrOpUpdates | 68,504,034 | 68,504,034 | 0 | | | nrPrimOpCalls | 429,464,805 | 429,464,805 | 0 | | | nrThunks | 1,009,240,391 | 982,109,100 | ↘ 27,131,291 | -2.69% | | sets-bytes | 33,524,722,928 | 33,524,722,928 | 0 | | | sets-elements | 1,938,309,212 | 1,938,309,212 | 0 | | | sets-number | 156,985,971 | 156,985,971 | 0 | | | sizes-Attr | 16 | 16 | 0 | | | sizes-Bindings | 16 | 16 | 0 | | | sizes-Env | 16 | 16 | 0 | | | sizes-Value | 24 | 24 | 0 | | | symbols-bytes | 2,151,298 | 2,151,298 | 0 | | | symbols-number | 159,707 | 159,707 | 0 | | | values-bytes | 30,218,194,248 | 29,567,043,264 | ↘ 651,150,984 | -2.15% | | values-number | 1,259,091,427 | 1,231,960,136 | ↘ 27,131,291 | -2.15% | > Accessing the lexical scope directly should be more efficient, yes, because it changes from a binary search (many lookups) to just two memory accesses > correction: one short linked list + one array access > oh and you had to do the lexical scope lookup anyway for lib itself > so it really does save a binary search at basically no extra cost - roberth after seeing the stats > Oooh nice. I did not consider that more of the maybeThunk optimization becomes effective (nrAvoided). Those lookups also caused allocations! - roberth Left `lib.generators` and `lib.strings` alone because they're only used once. --- pkgs/stdenv/generic/make-derivation.nix | 201 +++++++++++++++++++------------- 1 file changed, 119 insertions(+), 82 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index d235ffefaab..8c52eb10c3c 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -3,6 +3,43 @@ stdenv: let + # Lib attributes are inherited to the lexical scope for performance reasons. + inherit (lib) + any + assertMsg + attrNames + boolToString + chooseDevOutputs + concatLists + concatMap + concatMapStrings + concatStringsSep + elem + elemAt + extendDerivation + filter + findFirst + flip + head + imap1 + isAttrs + isBool + isDerivation + isInt + isList + isString + mapAttrs + mapNullable + optional + optionalAttrs + optionalString + optionals + remove + splitString + subtractLists + unique + ; + checkMeta = import ./check-meta.nix { inherit lib config; # Nix itself uses the `system` field of a derivation to decide where @@ -115,7 +152,7 @@ let # Including it then would cause needless mass rebuilds. # # TODO(@Ericson2314): Make [ "build" "host" ] always the default / resolve #87909 - configurePlatforms ? lib.optionals + configurePlatforms ? optionals (stdenv.hostPlatform != stdenv.buildPlatform || config.configurePlatformsByDefault) [ "build" "host" ] @@ -168,7 +205,7 @@ let # Policy on acceptable hash types in nixpkgs assert attrs ? outputHash -> ( let algo = - attrs.outputHashAlgo or (lib.head (lib.splitString "-" attrs.outputHash)); + attrs.outputHashAlgo or (head (splitString "-" attrs.outputHash)); in if algo == "md5" then throw "Rejected insecure ${algo} hash '${attrs.outputHash}'" @@ -183,12 +220,12 @@ let doInstallCheck' = doInstallCheck && stdenv.buildPlatform.canExecute stdenv.hostPlatform; separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux; - outputs' = outputs ++ lib.optional separateDebugInfo' "debug"; + outputs' = outputs ++ optional separateDebugInfo' "debug"; # Turn a derivation into its outPath without a string context attached. # See the comment at the usage site. unsafeDerivationToUntrackedOutpath = drv: - if lib.isDerivation drv + if isDerivation drv then builtins.unsafeDiscardStringContext drv.outPath else drv; @@ -198,9 +235,9 @@ let ++ depsTargetTarget ++ depsTargetTargetPropagated) == 0; dontAddHostSuffix = attrs ? outputHash && !noNonNativeDeps || !stdenv.hasCC; - hardeningDisable' = if lib.any (x: x == "fortify") hardeningDisable + hardeningDisable' = if any (x: x == "fortify") hardeningDisable # disabling fortify implies fortify3 should also be disabled - then lib.unique (hardeningDisable ++ [ "fortify3" ]) + then unique (hardeningDisable ++ [ "fortify3" ]) else hardeningDisable; supportedHardeningFlags = [ "fortify" "fortify3" "stackprotector" "pie" "pic" "strictoverflow" "format" "relro" "bindnow" ]; # Musl-based platforms will keep "pie", other platforms will not. @@ -212,19 +249,19 @@ let # - static armv7l, where compilation fails. !(stdenv.hostPlatform.isAarch && stdenv.hostPlatform.isStatic) then supportedHardeningFlags - else lib.remove "pie" supportedHardeningFlags; + else remove "pie" supportedHardeningFlags; enabledHardeningOptions = if builtins.elem "all" hardeningDisable' then [] - else lib.subtractLists hardeningDisable' (defaultHardeningFlags ++ hardeningEnable); + else subtractLists hardeningDisable' (defaultHardeningFlags ++ hardeningEnable); # hardeningDisable additionally supports "all". - erroneousHardeningFlags = lib.subtractLists supportedHardeningFlags (hardeningEnable ++ lib.remove "all" hardeningDisable); + erroneousHardeningFlags = subtractLists supportedHardeningFlags (hardeningEnable ++ remove "all" hardeningDisable); checkDependencyList = checkDependencyList' []; - checkDependencyList' = positions: name: deps: lib.flip lib.imap1 deps (index: dep: - if lib.isDerivation dep || dep == null || builtins.isString dep || builtins.isPath dep then dep - else if lib.isList dep then checkDependencyList' ([index] ++ positions) name dep - else throw "Dependency is not of a valid type: ${lib.concatMapStrings (ix: "element ${toString ix} of ") ([index] ++ positions)}${name} for ${attrs.name or attrs.pname}"); + checkDependencyList' = positions: name: deps: flip imap1 deps (index: dep: + if isDerivation dep || dep == null || builtins.isString dep || builtins.isPath dep then dep + else if isList dep then checkDependencyList' ([index] ++ positions) name dep + else throw "Dependency is not of a valid type: ${concatMapStrings (ix: "element ${toString ix} of ") ([index] ++ positions)}${name} for ${attrs.name or attrs.pname}"); in if builtins.length erroneousHardeningFlags != 0 then abort ("mkDerivation was called with unsupported hardening flags: " + lib.generators.toPretty {} { inherit erroneousHardeningFlags hardeningDisable hardeningEnable supportedHardeningFlags; @@ -233,20 +270,20 @@ else let doCheck = doCheck'; doInstallCheck = doInstallCheck'; buildInputs' = buildInputs - ++ lib.optionals doCheck checkInputs - ++ lib.optionals doInstallCheck installCheckInputs; + ++ optionals doCheck checkInputs + ++ optionals doInstallCheck installCheckInputs; nativeBuildInputs' = nativeBuildInputs - ++ lib.optional separateDebugInfo' ../../build-support/setup-hooks/separate-debug-info.sh - ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh - ++ lib.optionals doCheck nativeCheckInputs - ++ lib.optionals doInstallCheck nativeInstallCheckInputs; + ++ optional separateDebugInfo' ../../build-support/setup-hooks/separate-debug-info.sh + ++ optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh + ++ optionals doCheck nativeCheckInputs + ++ optionals doInstallCheck nativeInstallCheckInputs; outputs = outputs'; references = nativeBuildInputs ++ buildInputs ++ propagatedNativeBuildInputs ++ propagatedBuildInputs; - dependencies = map (map lib.chooseDevOutputs) [ + dependencies = map (map chooseDevOutputs) [ [ (map (drv: drv.__spliced.buildBuild or drv) (checkDependencyList "depsBuildBuild" depsBuildBuild)) (map (drv: drv.__spliced.buildHost or drv) (checkDependencyList "nativeBuildInputs" nativeBuildInputs')) @@ -260,7 +297,7 @@ else let (map (drv: drv.__spliced.targetTarget or drv) (checkDependencyList "depsTargetTarget" depsTargetTarget)) ] ]; - propagatedDependencies = map (map lib.chooseDevOutputs) [ + propagatedDependencies = map (map chooseDevOutputs) [ [ (map (drv: drv.__spliced.buildBuild or drv) (checkDependencyList "depsBuildBuildPropagated" depsBuildBuildPropagated)) (map (drv: drv.__spliced.buildHost or drv) (checkDependencyList "propagatedNativeBuildInputs" propagatedNativeBuildInputs)) @@ -276,26 +313,26 @@ else let ]; computedSandboxProfile = - lib.concatMap (input: input.__propagatedSandboxProfile or []) + concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraNativeBuildInputs ++ stdenv.extraBuildInputs - ++ lib.concatLists dependencies); + ++ concatLists dependencies); computedPropagatedSandboxProfile = - lib.concatMap (input: input.__propagatedSandboxProfile or []) - (lib.concatLists propagatedDependencies); + concatMap (input: input.__propagatedSandboxProfile or []) + (concatLists propagatedDependencies); computedImpureHostDeps = - lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) + unique (concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraNativeBuildInputs ++ stdenv.extraBuildInputs - ++ lib.concatLists dependencies)); + ++ concatLists dependencies)); computedPropagatedImpureHostDeps = - lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) - (lib.concatLists propagatedDependencies)); + unique (concatMap (input: input.__propagatedImpureHostDeps or []) + (concatLists propagatedDependencies)); - envIsExportable = lib.isAttrs env && !lib.isDerivation env; + envIsExportable = isAttrs env && !isDerivation env; derivationArg = (removeAttrs attrs @@ -306,8 +343,8 @@ else let "__darwinAllowLocalNetworking" "__impureHostDeps" "__propagatedImpureHostDeps" "sandboxProfile" "propagatedSandboxProfile"] - ++ lib.optional (__structuredAttrs || envIsExportable) "env")) - // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { + ++ optional (__structuredAttrs || envIsExportable) "env")) + // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { name = let # Indicate the host platform of the derivation if cross compiling. @@ -315,7 +352,7 @@ else let # suffix. But we have some weird ones with run-time deps that are # just used for their side-affects. Those might as well since the # hash can't be the same. See #32986. - hostSuffix = lib.optionalString + hostSuffix = optionalString (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix) "-${stdenv.hostPlatform.config}"; @@ -324,17 +361,17 @@ else let # nix and nixStatic. This should be also achieved by moving the # hostSuffix before the version, so we could contemplate removing # it again. - staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static"; + staticMarker = optionalString stdenv.hostPlatform.isStatic "-static"; in lib.strings.sanitizeDerivationName ( if attrs ? name then attrs.name + hostSuffix else # we cannot coerce null to a string below - assert lib.assertMsg (attrs ? version && attrs.version != null) "The ‘version’ attribute cannot be null."; + assert assertMsg (attrs ? version && attrs.version != null) "The ‘version’ attribute cannot be null."; "${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}" ); - }) // lib.optionalAttrs __structuredAttrs { env = checkedEnv; } // { + }) // optionalAttrs __structuredAttrs { env = checkedEnv; } // { builder = attrs.realBuilder or stdenv.shell; args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; inherit stdenv; @@ -351,22 +388,22 @@ else let __ignoreNulls = true; inherit __structuredAttrs strictDeps; - depsBuildBuild = lib.elemAt (lib.elemAt dependencies 0) 0; - nativeBuildInputs = lib.elemAt (lib.elemAt dependencies 0) 1; - depsBuildTarget = lib.elemAt (lib.elemAt dependencies 0) 2; - depsHostHost = lib.elemAt (lib.elemAt dependencies 1) 0; - buildInputs = lib.elemAt (lib.elemAt dependencies 1) 1; - depsTargetTarget = lib.elemAt (lib.elemAt dependencies 2) 0; + depsBuildBuild = elemAt (elemAt dependencies 0) 0; + nativeBuildInputs = elemAt (elemAt dependencies 0) 1; + depsBuildTarget = elemAt (elemAt dependencies 0) 2; + depsHostHost = elemAt (elemAt dependencies 1) 0; + buildInputs = elemAt (elemAt dependencies 1) 1; + depsTargetTarget = elemAt (elemAt dependencies 2) 0; - depsBuildBuildPropagated = lib.elemAt (lib.elemAt propagatedDependencies 0) 0; - propagatedNativeBuildInputs = lib.elemAt (lib.elemAt propagatedDependencies 0) 1; - depsBuildTargetPropagated = lib.elemAt (lib.elemAt propagatedDependencies 0) 2; - depsHostHostPropagated = lib.elemAt (lib.elemAt propagatedDependencies 1) 0; - propagatedBuildInputs = lib.elemAt (lib.elemAt propagatedDependencies 1) 1; - depsTargetTargetPropagated = lib.elemAt (lib.elemAt propagatedDependencies 2) 0; + depsBuildBuildPropagated = elemAt (elemAt propagatedDependencies 0) 0; + propagatedNativeBuildInputs = elemAt (elemAt propagatedDependencies 0) 1; + depsBuildTargetPropagated = elemAt (elemAt propagatedDependencies 0) 2; + depsHostHostPropagated = elemAt (elemAt propagatedDependencies 1) 0; + propagatedBuildInputs = elemAt (elemAt propagatedDependencies 1) 1; + depsTargetTargetPropagated = elemAt (elemAt propagatedDependencies 2) 0; # This parameter is sometimes a string, sometimes null, and sometimes a list, yuck - configureFlags = let inherit (lib) optional elem; in + configureFlags = configureFlags ++ optional (elem "build" configurePlatforms) "--build=${stdenv.buildPlatform.config}" ++ optional (elem "host" configurePlatforms) "--host=${stdenv.hostPlatform.config}" @@ -374,21 +411,21 @@ else let cmakeFlags = cmakeFlags - ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) ([ - "-DCMAKE_SYSTEM_NAME=${lib.findFirst lib.isString "Generic" (lib.optional (!stdenv.hostPlatform.isRedox) stdenv.hostPlatform.uname.system)}" - ] ++ lib.optionals (stdenv.hostPlatform.uname.processor != null) [ + ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) ([ + "-DCMAKE_SYSTEM_NAME=${findFirst isString "Generic" (optional (!stdenv.hostPlatform.isRedox) stdenv.hostPlatform.uname.system)}" + ] ++ optionals (stdenv.hostPlatform.uname.processor != null) [ "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}" - ] ++ lib.optionals (stdenv.hostPlatform.uname.release != null) [ + ] ++ optionals (stdenv.hostPlatform.uname.release != null) [ "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.uname.release}" - ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ + ] ++ optionals (stdenv.hostPlatform.isDarwin) [ "-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}" - ] ++ lib.optionals (stdenv.buildPlatform.uname.system != null) [ + ] ++ optionals (stdenv.buildPlatform.uname.system != null) [ "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}" - ] ++ lib.optionals (stdenv.buildPlatform.uname.processor != null) [ + ] ++ optionals (stdenv.buildPlatform.uname.processor != null) [ "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}" - ] ++ lib.optionals (stdenv.buildPlatform.uname.release != null) [ + ] ++ optionals (stdenv.buildPlatform.uname.release != null) [ "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}" - ] ++ lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "-DCMAKE_CROSSCOMPILING_EMULATOR=env" ]); @@ -402,7 +439,7 @@ else let crossFile = builtins.toFile "cross-file.conf" '' [properties] - needs_exe_wrapper = ${lib.boolToString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)} + needs_exe_wrapper = ${boolToString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)} [host_machine] system = '${stdenv.targetPlatform.parsed.kernel.name}' @@ -413,7 +450,7 @@ else let [binaries] llvm-config = 'llvm-config-native' ''; - crossFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ]; + crossFlags = optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ]; in crossFlags ++ mesonFlags; inherit patches; @@ -421,28 +458,28 @@ else let inherit doCheck doInstallCheck; inherit outputs; - } // lib.optionalAttrs (__contentAddressed) { + } // optionalAttrs (__contentAddressed) { inherit __contentAddressed; # Provide default values for outputHashMode and outputHashAlgo because # most people won't care about these anyways outputHashAlgo = attrs.outputHashAlgo or "sha256"; outputHashMode = attrs.outputHashMode or "recursive"; - } // lib.optionalAttrs (enableParallelBuilding) { + } // optionalAttrs (enableParallelBuilding) { inherit enableParallelBuilding; enableParallelChecking = attrs.enableParallelChecking or true; enableParallelInstalling = attrs.enableParallelInstalling or true; - } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != [] || stdenv.hostPlatform.isMusl) { + } // optionalAttrs (hardeningDisable != [] || hardeningEnable != [] || stdenv.hostPlatform.isMusl) { NIX_HARDENING_ENABLE = enabledHardeningOptions; - } // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? gcc.arch) { + } // optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? gcc.arch) { requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.gcc.arch}" ]; - } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { + } // optionalAttrs (stdenv.buildPlatform.isDarwin) { inherit __darwinAllowLocalNetworking; - # TODO: remove lib.unique once nix has a list canonicalization primitive + # TODO: remove `unique` once nix has a list canonicalization primitive __sandboxProfile = let profiles = [ stdenv.extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ]; - final = lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.unique profiles)); + final = concatStringsSep "\n" (filter (x: x != "") (unique profiles)); in final; - __propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]); + __propagatedSandboxProfile = unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]); __impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ stdenv.__extraImpureHostDeps ++ [ "/dev/zero" "/dev/random" @@ -469,21 +506,21 @@ else let # to be built eventually, we would still like to get the error early and without # having to wait while nix builds a derivation that might not be used. # See also https://github.com/NixOS/nix/issues/4629 - lib.optionalAttrs (attrs ? disallowedReferences) { + optionalAttrs (attrs ? disallowedReferences) { disallowedReferences = map unsafeDerivationToUntrackedOutpath attrs.disallowedReferences; } // - lib.optionalAttrs (attrs ? disallowedRequisites) { + optionalAttrs (attrs ? disallowedRequisites) { disallowedRequisites = map unsafeDerivationToUntrackedOutpath attrs.disallowedRequisites; } // - lib.optionalAttrs (attrs ? allowedReferences) { + optionalAttrs (attrs ? allowedReferences) { allowedReferences = - lib.mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedReferences; + mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedReferences; } // - lib.optionalAttrs (attrs ? allowedRequisites) { + optionalAttrs (attrs ? allowedRequisites) { allowedRequisites = - lib.mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedRequisites; + mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedRequisites; }; meta = checkMeta.commonMeta { inherit validity attrs pos references; }; @@ -491,20 +528,20 @@ else let checkedEnv = let - overlappingNames = lib.attrNames (builtins.intersectAttrs env derivationArg); + overlappingNames = attrNames (builtins.intersectAttrs env derivationArg); in - assert lib.assertMsg envIsExportable + assert assertMsg envIsExportable "When using structured attributes, `env` must be an attribute set of environment variables."; - assert lib.assertMsg (overlappingNames == [ ]) - "The ‘env’ attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping: ${lib.concatStringsSep ", " overlappingNames}"; - lib.mapAttrs - (n: v: assert lib.assertMsg (lib.isString v || lib.isBool v || lib.isInt v || lib.isDerivation v) + assert assertMsg (overlappingNames == [ ]) + "The ‘env’ attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping: ${concatStringsSep ", " overlappingNames}"; + mapAttrs + (n: v: assert assertMsg (isString v || isBool v || isInt v || isDerivation v) "The ‘env’ attribute set can only contain derivation, string, boolean or integer attributes. The ‘${n}’ attribute is of type ${builtins.typeOf v}."; v) env; in -lib.extendDerivation +extendDerivation validity.handled ({ # A derivation that always builds successfully and whose runtime @@ -553,7 +590,7 @@ lib.extendDerivation # should be made available to Nix expressions using the # derivation (e.g., in assertions). passthru) - (derivation (derivationArg // lib.optionalAttrs envIsExportable checkedEnv)); + (derivation (derivationArg // optionalAttrs envIsExportable checkedEnv)); in fnOrAttrs: -- cgit 1.4.1 From 887d33a089c556592b789a7699019babf8aa2402 Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 12 Nov 2023 05:52:30 -0800 Subject: freshBootstrapTools: Overlay the package set with the desired LLVM As reported in #241692, since the `llvmPackages` bump the bootstrap-tools started failing to build due to a mismatch in LLVM versions used to build certain tools. By overlaying the imported package set to specify `llvmPackages`, we get everything built with the expected LLVM version. --- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index 448d6ecd9f1..b51b5fdb34b 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -1,5 +1,8 @@ { pkgspath ? ../../.., test-pkgspath ? pkgspath , localSystem ? { system = builtins.currentSystem; } +# Specify the desired LLVM version in an overlay to avoid the use of +# mismatching versions. +, overlays ? [(self: super: { llvmPackages = super.llvmPackages_11; })] , crossSystem ? null , bootstrapFiles ? null }: @@ -13,11 +16,9 @@ let cross = if crossSystem != null in (import "${pkgspath}/pkgs/stdenv/darwin" args'); } else {}; -in with import pkgspath ({ inherit localSystem; } // cross // custom-bootstrap); +in with import pkgspath ({ inherit localSystem overlays; } // cross // custom-bootstrap); -let - llvmPackages = llvmPackages_11; -in rec { +rec { coreutils_ = coreutils.override (args: { # We want coreutils without ACL support. aclSupport = false; -- cgit 1.4.1 From 985ff1cb889d5a438c6812ed827f375c1ee92b99 Mon Sep 17 00:00:00 2001 From: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com> Date: Fri, 17 Nov 2023 08:26:41 +0000 Subject: Update pkgs/stdenv/darwin/make-bootstrap-tools.nix --- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index b51b5fdb34b..5be6e2a4e6e 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -2,6 +2,19 @@ , localSystem ? { system = builtins.currentSystem; } # Specify the desired LLVM version in an overlay to avoid the use of # mismatching versions. +# +# The llvmPackages that we take things (clang, libc++ and such) from +# is specified explicitly to be llvmPackages_11 to keep the +# bootstrap-tools stable. However, tools like otool, +# install_name_tool and strip are taken straight from stdenv.cc, +# which, after the bump, is a different LLVM version altogether. +# +# The original intent was that bootstrap-tools specified LLVM 11 +# exhaustively but it didn't. That should be rectified with this +# PR. As to why stick with 11? That's just to keep the +# bootstrap-tools unchanged. +# +# https://github.com/NixOS/nixpkgs/pull/267058/files#r1390889848 , overlays ? [(self: super: { llvmPackages = super.llvmPackages_11; })] , crossSystem ? null , bootstrapFiles ? null -- cgit 1.4.1