diff options
author | Silvan Mosberger <contact@infinisil.com> | 2021-05-05 23:20:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-05 23:20:39 +0200 |
commit | f445acbe0acbae160c8956e61f2902be3ab4409f (patch) | |
tree | 55be85ae5e118c51255b5fb68679490569cc9d9f /lib | |
parent | 37562a2295490c9a17d64ad00151100c8f04d688 (diff) | |
parent | 810c9c6a0ea9a021426acf8ae3f2bcfbde545ef7 (diff) |
Merge pull request #114955 from berbiche/fix/modules-imports-list
lib/modules: provide a better error message when "imports" contains a list
Diffstat (limited to 'lib')
-rw-r--r-- | lib/modules.nix | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index d515ee24d16ef..6b3faa447be1f 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -23,6 +23,7 @@ let isAttrs isBool isFunction + isList isString length mapAttrs @@ -188,6 +189,9 @@ rec { loadModule = args: fallbackFile: fallbackKey: m: if isFunction m || isAttrs m then unifyModuleSyntax fallbackFile fallbackKey (applyIfFunction fallbackKey m args) + else if isList m then + let defs = [{ file = fallbackFile; value = m; }]; in + throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}" else unifyModuleSyntax (toString m) (toString m) (applyIfFunction (toString m) (import m) args); /* |