Merge pull request #2455 from bjornfor/helpful-messages-when-refusing-eval
More helpful message when refusing to evaluate "broken" package
This commit is contained in:
commit
e80f41f35e
|
@ -29,6 +29,16 @@ let
|
||||||
|
|
||||||
allowBroken = config.allowBroken or false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
|
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);
|
unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null);
|
||||||
|
|
||||||
# The stdenv that we are producing.
|
# The stdenv that we are producing.
|
||||||
|
@ -76,15 +86,16 @@ let
|
||||||
in
|
in
|
||||||
if !allowUnfree && (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l) && !(allowUnfreePredicate attrs) then
|
if !allowUnfree && (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l) && !(allowUnfreePredicate attrs) then
|
||||||
throw ''
|
throw ''
|
||||||
Package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate. You can set
|
Package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate.
|
||||||
{ nixpkgs.config.allowUnfree = true; }
|
${forceEvalHelp "Unfree"}''
|
||||||
in configuration.nix to override this. If you use Nix standalone, you can add
|
|
||||||
{ allowUnfree = true; }
|
|
||||||
to ~/.nixpkgs/config.nix.''
|
|
||||||
else if !allowBroken && attrs.meta.broken or false then
|
else if !allowBroken && attrs.meta.broken or false then
|
||||||
throw "you can't use package ‘${attrs.name}’ in ${pos'} because it has been marked as broken"
|
throw ''
|
||||||
|
Package ‘${attrs.name}’ in ${pos'} is marked as broken, refusing to evaluate.
|
||||||
|
${forceEvalHelp "Broken"}''
|
||||||
else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then
|
else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then
|
||||||
throw "the package ‘${attrs.name}’ in ${pos'} is not supported on ‘${result.system}’"
|
throw ''
|
||||||
|
Package ‘${attrs.name}’ in ${pos'} is not supported on ‘${result.system}’, refusing to evaluate.
|
||||||
|
${forceEvalHelp "Broken"}''
|
||||||
else
|
else
|
||||||
lib.addPassthru (derivation (
|
lib.addPassthru (derivation (
|
||||||
(removeAttrs attrs ["meta" "passthru" "crossAttrs"])
|
(removeAttrs attrs ["meta" "passthru" "crossAttrs"])
|
||||||
|
|
Loading…
Reference in New Issue