diff --git a/lib/modules.nix b/lib/modules.nix index b124ea000a2..51e12f0659c 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -162,13 +162,24 @@ rec { baseMsg = "The option `${showOption (prefix ++ firstDef.prefix)}' does not exist. Definition values:${showDefs [ firstDef ]}"; in if attrNames options == [ "_module" ] - then throw '' - ${baseMsg} + then + let + optionName = showOption prefix; + in + if optionName == "" + then throw '' + ${baseMsg} - However there are no options defined in `${showOption prefix}'. Are you sure you've - declared your options properly? This can happen if you e.g. declared your options in `types.submodule' - under `config' rather than `options'. - '' + It seems as you're trying to declare an option by placing it into `config' rather than `options'! + '' + else + throw '' + ${baseMsg} + + However there are no options defined in `${showOption prefix}'. Are you sure you've + declared your options properly? This can happen if you e.g. declared your options in `types.submodule' + under `config' rather than `options'. + '' else throw baseMsg else null;