summary refs log tree commit diff
path: root/pkgs/stdenv/generic
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-22 15:21:10 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-22 15:43:18 -0400
commitbf2b75ca7ec6e69f85e7e05ec1bd85785163b5f4 (patch)
tree66f69c97eb1f81182ebebd5dcc4a966afcba7da4 /pkgs/stdenv/generic
parent85047983a152b55e01f01ca6ee984696af9da684 (diff)
downloadnixpkgs-bf2b75ca7ec6e69f85e7e05ec1bd85785163b5f4.tar
nixpkgs-bf2b75ca7ec6e69f85e7e05ec1bd85785163b5f4.tar.gz
nixpkgs-bf2b75ca7ec6e69f85e7e05ec1bd85785163b5f4.tar.bz2
nixpkgs-bf2b75ca7ec6e69f85e7e05ec1bd85785163b5f4.tar.lz
nixpkgs-bf2b75ca7ec6e69f85e7e05ec1bd85785163b5f4.tar.xz
nixpkgs-bf2b75ca7ec6e69f85e7e05ec1bd85785163b5f4.tar.zst
nixpkgs-bf2b75ca7ec6e69f85e7e05ec1bd85785163b5f4.zip
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.
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r--pkgs/stdenv/generic/default.nix5
1 files changed, 5 insertions, 0 deletions
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