lib/modules: Throw better error when definitions assign to an option set

This commit is contained in:
Silvan Mosberger
2020-03-18 04:38:50 +01:00
parent dcdd232939
commit 15c873b486
3 changed files with 10 additions and 1 deletions
+3 -1
View File
@@ -299,7 +299,9 @@ rec {
in
throw "The option `${showOption loc}' in `${firstOption._file}' is a prefix of options in `${firstNonOption._file}'."
else
mergeModules' loc decls defns
if all (def: isAttrs def.value) defns' then mergeModules' loc decls defns
else let firstInvalid = findFirst (def: ! isAttrs def.value) null defns';
in throw "The option path `${showOption loc}' is an attribute set of options, but it is defined to not be an attribute set in `${firstInvalid.file}'. Did you define its value at the correct and complete path?"
))
// { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; };