diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 3555ea98015..9197ff8314b 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -10,6 +10,8 @@ let lib = import ../../lib; + disallowUnfree = builtins.getEnv "HYDRA_DISALLOW_UNFREE" == "1"; + stdenvGenerator = setupScript: rec { # The stdenv that we are producing. @@ -39,6 +41,9 @@ let # Add a utility function to produce derivations that use this # stdenv and its shell. mkDerivation = attrs: + if disallowUnfree && attrs.meta.license or "" == "unfree" then + throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate" + else (derivation ( (removeAttrs attrs ["meta" "passthru" "crossAttrs"]) // (let