stdenv: More useful error message on bad meta attrs

This helps in debugging meta attribute type errors,
which are now enforced as of commit
90b9719f4f.
This commit is contained in:
Aneesh Agrawal 2017-05-02 01:45:30 -04:00
parent bd9246b009
commit d3acf9891c

View file

@ -236,7 +236,7 @@ let
checkMetaAttr = k: v:
if metaTypes?${k} then
if metaTypes.${k}.check v then null else "key '${k}' has a value of an invalid type; expected ${metaTypes.${k}.description}"
if metaTypes.${k}.check v then null else "key '${k}' has a value ${v} of an invalid type ${builtins.typeOf v}; expected ${metaTypes.${k}.description}"
else "key '${k}' is unrecognized; expected one of: \n\t [${lib.concatMapStringsSep ", " (x: "'${x}'") (lib.attrNames metaTypes)}]";
checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];