stdenv: allow specifying a eval issuee handler
This commit is contained in:
parent
3a110ea3f9
commit
f33a513d2b
|
@ -125,11 +125,18 @@ let
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
throwEvalHelp = { reason , errormsg ? "" }:
|
handleEvalIssue = { reason , errormsg ? "" }:
|
||||||
(if reason != "unknown-meta" then throw else (x : builtins.trace x true)) (''
|
let
|
||||||
Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate.
|
msg = ''
|
||||||
|
Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate.
|
||||||
|
|
||||||
|
'' + (builtins.getAttr reason remediation) attrs;
|
||||||
|
|
||||||
|
handler = if config ? "handleEvalIssue"
|
||||||
|
then config.handleEvalIssue reason
|
||||||
|
else throw;
|
||||||
|
in handler msg;
|
||||||
|
|
||||||
'' + ((builtins.getAttr reason remediation) attrs));
|
|
||||||
|
|
||||||
metaTypes = with lib.types; rec {
|
metaTypes = with lib.types; rec {
|
||||||
# These keys are documented
|
# These keys are documented
|
||||||
|
@ -192,7 +199,7 @@ let
|
||||||
validityCondition =
|
validityCondition =
|
||||||
let v = checkValidity attrs;
|
let v = checkValidity attrs;
|
||||||
in if !v.valid
|
in if !v.valid
|
||||||
then throwEvalHelp (removeAttrs v ["valid"])
|
then handleEvalIssue (removeAttrs v ["valid"])
|
||||||
else true;
|
else true;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in a new issue