summary refs log tree commit diff
path: root/pkgs/stdenv/darwin/default.nix
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/darwin/default.nix
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/darwin/default.nix')
-rw-r--r--pkgs/stdenv/darwin/default.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index a7b91a82a9d2c..d50b60b0ba13e 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: {}),