summary refs log tree commit diff
path: root/pkgs/stdenv/generic
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2015-01-13 18:05:43 +0100
committerVladimír Čunát <vcunat@gmail.com>2015-01-13 18:07:11 +0100
commit1575bc652eeee758816d63efccd1ab6eca16d2c9 (patch)
treeab042157cc9f9304d9e05bb242681c7b7d0bb556 /pkgs/stdenv/generic
parent1c0477c08cfcb04d41bf7c0b828d642ce2956b4d (diff)
parent7637e71cee2b11d340c5ce99d777f6783a6b9885 (diff)
downloadnixlib-1575bc652eeee758816d63efccd1ab6eca16d2c9.tar
nixlib-1575bc652eeee758816d63efccd1ab6eca16d2c9.tar.gz
nixlib-1575bc652eeee758816d63efccd1ab6eca16d2c9.tar.bz2
nixlib-1575bc652eeee758816d63efccd1ab6eca16d2c9.tar.lz
nixlib-1575bc652eeee758816d63efccd1ab6eca16d2c9.tar.xz
nixlib-1575bc652eeee758816d63efccd1ab6eca16d2c9.tar.zst
nixlib-1575bc652eeee758816d63efccd1ab6eca16d2c9.zip
Merge branch 'master' into staging
Conflicts (simple):
	pkgs/os-specific/linux/util-linux/default.nix

It seems this merge creates a new stdenv hash,
because we had changes on both branches :-/
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r--pkgs/stdenv/generic/default.nix33
1 files changed, 15 insertions, 18 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index d50ac9f430e5..53940d211199 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -27,15 +27,6 @@ let
 
   allowBroken = config.allowBroken or false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
 
-  forceEvalHelp = unfreeOrBroken:
-    assert (unfreeOrBroken == "Unfree" || unfreeOrBroken == "Broken");
-    ''
-      You can set
-        { nixpkgs.config.allow${unfreeOrBroken} = true; }
-      in configuration.nix to override this. If you use Nix standalone, you can add
-        { allow${unfreeOrBroken} = true; }
-      to ~/.nixpkgs/config.nix.'';
-
   unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null);
 
   isUnfree = licenses: lib.lists.any (l:
@@ -61,19 +52,25 @@ let
         else
           unsafeGetAttrPos "name" attrs;
       pos' = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»";
+
+      throwEvalHelp = unfreeOrBroken: whatIsWrong:
+        assert (unfreeOrBroken == "Unfree" || unfreeOrBroken == "Broken");
+        throw ''
+          Package ‘${attrs.name}’ in ${pos'} ${whatIsWrong}, refusing to evaluate.
+          For `nixos-rebuild` you can set
+            { nixpkgs.config.allow${unfreeOrBroken} = true; }
+          in configuration.nix to override this.
+          For `nix-env` you can add
+            { allow${unfreeOrBroken} = true; }
+          to ~/.nixpkgs/config.nix.
+        '';
     in
     if !allowUnfree && isUnfree (lib.lists.toList attrs.meta.license or []) && !allowUnfreePredicate attrs then
-      throw ''
-        Package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate.
-        ${forceEvalHelp "Unfree"}''
+      throwEvalHelp "Unfree" "has an unfree license"
     else if !allowBroken && attrs.meta.broken or false then
-      throw ''
-        Package ‘${attrs.name}’ in ${pos'} is marked as broken, refusing to evaluate.
-        ${forceEvalHelp "Broken"}''
+      throwEvalHelp "Broken" "is marked as broken"
     else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then
-      throw ''
-        Package ‘${attrs.name}’ in ${pos'} is not supported on ‘${result.system}’, refusing to evaluate.
-        ${forceEvalHelp "Broken"}''
+      throwEvalHelp "Broken" "is not supported on ‘${result.system}’"
     else
       lib.addPassthru (derivation (
         (removeAttrs attrs ["meta" "passthru" "crossAttrs"])