From 62585a363f21d8101a7eba411d9957e7ac59b863 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 4 Sep 2013 11:49:56 +0200 Subject: [PATCH] Support "imports" in abbreviated modules In abbreviated modules (those without a "config" attribute), you can use "require", but it doesn't behave in the same way. For consistency we should use "imports" everywhere. --- pkgs/lib/modules.nix | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkgs/lib/modules.nix b/pkgs/lib/modules.nix index 9dda89b09f0..acd10e7bf57 100644 --- a/pkgs/lib/modules.nix +++ b/pkgs/lib/modules.nix @@ -46,25 +46,21 @@ rec { unifyModuleSyntax = m: let delayedModule = delayProperties m; - getImports = - if m ? config || m ? options then - m.imports or [] - else - toList (rmProperties (delayedModule.require or [])); + getImports = + toList (rmProperties (delayedModule.require or [])); getImportedPaths = filter isPath getImports; getImportedSets = filter (x: !isPath x) getImports; getConfig = - removeAttrs delayedModule ["require" "key"]; + removeAttrs delayedModule ["require" "key" "imports"]; in if isModule m then { key = ""; } // m else - { - key = ""; - imports = getImportedPaths; + { key = ""; + imports = (m.imports or []) ++ getImportedPaths; config = getConfig; } // ( if getImportedSets != [] then