about summary refs log tree commit diff
path: root/pkgs/stdenv/linux
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-04-26 17:21:17 +0200
committerregnat <rg@regnat.ovh>2021-04-28 10:25:49 +0200
commit14f66d60a789da5cc48d0602b390a267f016143d (patch)
treef7edeac77c0d8c7d344df394dcda07f8835be9eb /pkgs/stdenv/linux
parent559c5792ef1d0ef413e0abd5ddd07409989ceb1c (diff)
Make the bootsrap respect the contentAddressedByDefault setting
Patch every `derivation` call in the bootsrap process to add it a
conditional `__contentAddressed` parameter.

That way, passing `contentAddressedByDefault` means that the entire
build closure of a system can be content addressed
Diffstat (limited to 'pkgs/stdenv/linux')
-rw-r--r--pkgs/stdenv/linux/bootstrap-tools-musl/default.nix6
-rw-r--r--pkgs/stdenv/linux/bootstrap-tools/default.nix6
-rw-r--r--pkgs/stdenv/linux/default.nix11
3 files changed, 16 insertions, 7 deletions
diff --git a/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix b/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix
index 6118585d545f9..d690f40267217 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 6118585d545f9..d690f40267217 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 f753af4992674..6d6d0384a7ff4 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};