1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00

Merge pull request #114955 from berbiche/fix/modules-imports-list

lib/modules: provide a better error message when "imports" contains a list
This commit is contained in:
Silvan Mosberger 2021-05-05 23:20:39 +02:00 committed by GitHub
commit f445acbe0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
/*