Add config option ‘allowUnfree’
If set to false, mkDerivation will throw an exception if a package has an unfree license. ‘release-lib.nix’ uses this to enforce that we don't build unfree packages as part of the Nixpkgs channel. Since this is set through Nixpkgs' ‘config’ argument, it's more finegrained than $HYDRA_DISALLOW_UNFREE.
This commit is contained in:
@@ -10,7 +10,7 @@ let
|
||||
|
||||
lib = import ../../lib;
|
||||
|
||||
disallowUnfree = builtins.getEnv "HYDRA_DISALLOW_UNFREE" == "1";
|
||||
allowUnfree = config.allowUnfree or true && builtins.getEnv "HYDRA_DISALLOW_UNFREE" != "1";
|
||||
|
||||
stdenvGenerator = setupScript: rec {
|
||||
|
||||
@@ -41,7 +41,7 @@ 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
|
||||
if !allowUnfree && attrs.meta.license or "" == "unfree" then
|
||||
throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
|
||||
else
|
||||
(derivation (
|
||||
|
||||
Reference in New Issue
Block a user