forked from mirrors/nixpkgs
Add hacky way to prevent Hydra from building/distributing unfree packages
If the environment variable HYDRA_DISALLOW_UNFREE is set to "1", then evaluation of a package with license "unfree" will throw an error. Thus such packages or any packages that depend on them will fail to evaluate.
This commit is contained in:
parent
85047983a1
commit
bf2b75ca7e
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue