From cc5b30c6ac03273cfd76975ba83744a210f1704d Mon Sep 17 00:00:00 2001 From: regnat Date: Fri, 23 Apr 2021 10:54:38 +0200 Subject: [PATCH] Make it easy to build everything as content-addressed Add a config field `contentAddressedByDefault` and an associated environment variable `NIXPKGS_CA_BY_DEFAULT` to make every nixpkgs derivation content-addressed by default --- pkgs/stdenv/generic/make-derivation.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 5b446b118269..2bceb9e4333e 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -89,7 +89,10 @@ in rec { , patches ? [] - , __contentAddressed ? false + , __contentAddressed ? + (! attrs ? outputHash) # Fixed-output drvs can't be content addressed too + && (config.contentAddressedByDefault or false + || builtins.getEnv "NIXPKGS_CA_BY_DEFAULT" == "1") , ... } @ attrs: