From d8e722985bac5f8448d5287840ee50517154443e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 17 Jan 2013 23:41:37 +0100 Subject: [PATCH] =?UTF-8?q?Add=20config=20option=20=E2=80=98allowUnfree?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pkgs/os-specific/linux/aufs/3.nix | 1 + pkgs/stdenv/generic/default.nix | 4 ++-- pkgs/top-level/release-lib.nix | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/os-specific/linux/aufs/3.nix b/pkgs/os-specific/linux/aufs/3.nix index 130fd5075cd5..255804a31de9 100644 --- a/pkgs/os-specific/linux/aufs/3.nix +++ b/pkgs/os-specific/linux/aufs/3.nix @@ -33,6 +33,7 @@ stdenv.mkDerivation { ''; passthru = { inherit patch; }; + meta = { description = "Another Unionfs implementation for Linux (third generation)"; homepage = http://aufs.sourceforge.net/; diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 852be9612fb5..b6836ca8d79c 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -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 ( diff --git a/pkgs/top-level/release-lib.nix b/pkgs/top-level/release-lib.nix index 4a5f7602d02d..d03f2724e1f0 100644 --- a/pkgs/top-level/release-lib.nix +++ b/pkgs/top-level/release-lib.nix @@ -1,7 +1,11 @@ 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 Nixpkgs from being evaluated again and again for every