diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index a7b91a82a9d2..d50b60b0ba13 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -44,7 +44,7 @@ in rec { stripAllFlags=" " # the Darwin "strip" command doesn't know "-s" ''; - bootstrapTools = derivation { + bootstrapTools = derivation ({ inherit system; name = "bootstrap-tools"; @@ -54,7 +54,11 @@ in rec { inherit (bootstrapFiles) mkdir bzip2 cpio tarball; __impureHostDeps = commonImpureHostDeps; - }; + } // lib.optionalAttrs (config.contentAddressedByDefault or false) { + __contentAddressed = true; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + }); stageFun = step: last: {shell ? "${bootstrapTools}/bin/bash", overrides ? (self: super: {}), diff --git a/pkgs/stdenv/freebsd/default.nix b/pkgs/stdenv/freebsd/default.nix index 9a890532b790..ddcdc6a66e08 100644 --- a/pkgs/stdenv/freebsd/default.nix +++ b/pkgs/stdenv/freebsd/default.nix @@ -170,7 +170,7 @@ in ({}: { __raw = true; - bootstrapTools = derivation { + bootstrapTools = derivation ({ inherit system; inherit make bash coreutils findutils diffutils grep patch gawk cpio sed @@ -182,7 +182,11 @@ in buildInputs = [ make ]; mkdir = "/bin/mkdir"; ln = "/bin/ln"; - }; + } // lib.optionalAttrs (config.contentAddressedByDefault or false) { + __contentAddressed = true; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + }); }) ({ bootstrapTools, ... }: rec { diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index c3582b166779..516d2d3c177d 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -84,6 +84,11 @@ let allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs ++ defaultBuildInputs; } + // lib.optionalAttrs (config.contentAddressedByDefault or false) { + __contentAddressed = true; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + } // { inherit name; diff --git a/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix b/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix index 6118585d545f..d690f4026721 100644 --- a/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix +++ b/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix @@ -1,6 +1,6 @@ -{ system, bootstrapFiles }: +{ system, bootstrapFiles, extraAttrs }: -derivation { +derivation ({ name = "bootstrap-tools"; builder = bootstrapFiles.busybox; @@ -15,4 +15,4 @@ derivation { langC = true; langCC = true; isGNU = true; -} +} // extraAttrs) diff --git a/pkgs/stdenv/linux/bootstrap-tools/default.nix b/pkgs/stdenv/linux/bootstrap-tools/default.nix index 6118585d545f..d690f4026721 100644 --- a/pkgs/stdenv/linux/bootstrap-tools/default.nix +++ b/pkgs/stdenv/linux/bootstrap-tools/default.nix @@ -1,6 +1,6 @@ -{ system, bootstrapFiles }: +{ system, bootstrapFiles, extraAttrs }: -derivation { +derivation ({ name = "bootstrap-tools"; builder = bootstrapFiles.busybox; @@ -15,4 +15,4 @@ derivation { langC = true; langCC = true; isGNU = true; -} +} // extraAttrs) diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index f753af499267..6d6d0384a7ff 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -61,7 +61,16 @@ let # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...). - bootstrapTools = import (if localSystem.libc == "musl" then ./bootstrap-tools-musl else ./bootstrap-tools) { inherit system bootstrapFiles; }; + bootstrapTools = import (if localSystem.libc == "musl" then ./bootstrap-tools-musl else ./bootstrap-tools) { + inherit system bootstrapFiles; + extraAttrs = lib.optionalAttrs + (config.contentAddressedByDefault or false) + { + __contentAddressed = true; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + }; + }; getLibc = stage: stage.${localSystem.libc};