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:
Eelco Dolstra 2013-01-17 23:41:37 +01:00
parent deaef8abaf
commit d8e722985b
3 changed files with 9 additions and 4 deletions

View File

@ -33,6 +33,7 @@ stdenv.mkDerivation {
''; '';
passthru = { inherit patch; }; passthru = { inherit patch; };
meta = { meta = {
description = "Another Unionfs implementation for Linux (third generation)"; description = "Another Unionfs implementation for Linux (third generation)";
homepage = http://aufs.sourceforge.net/; homepage = http://aufs.sourceforge.net/;

View File

@ -10,7 +10,7 @@ let
lib = import ../../lib; lib = import ../../lib;
disallowUnfree = builtins.getEnv "HYDRA_DISALLOW_UNFREE" == "1"; allowUnfree = config.allowUnfree or true && builtins.getEnv "HYDRA_DISALLOW_UNFREE" != "1";
stdenvGenerator = setupScript: rec { stdenvGenerator = setupScript: rec {
@ -41,7 +41,7 @@ let
# Add a utility function to produce derivations that use this # Add a utility function to produce derivations that use this
# stdenv and its shell. # stdenv and its shell.
mkDerivation = attrs: 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" throw "package ${attrs.name} has an unfree license, refusing to evaluate"
else else
(derivation ( (derivation (

View File

@ -1,7 +1,11 @@
rec { rec {
allPackages = import ./all-packages.nix;
pkgs = allPackages {}; # Ensure that we don't build packages marked as unfree.
allPackages = args: import ./all-packages.nix (args // {
config.allowUnfree = false;
});
pkgs = allPackages { };
/* !!! Hack: poor man's memoisation function. Necessary for prevent /* !!! Hack: poor man's memoisation function. Necessary for prevent
Nixpkgs from being evaluated again and again for every Nixpkgs from being evaluated again and again for every