summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-04 11:49:56 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-04 13:04:50 +0200
commit62585a363f21d8101a7eba411d9957e7ac59b863 (patch)
tree0c2c93b8080d12943ca0af6e03fcc04d5b180111
parente55c0bcaaa80cb0588563acc9c793a2d723e8eb7 (diff)
downloadnixpkgs-62585a363f21d8101a7eba411d9957e7ac59b863.tar
nixpkgs-62585a363f21d8101a7eba411d9957e7ac59b863.tar.gz
nixpkgs-62585a363f21d8101a7eba411d9957e7ac59b863.tar.bz2
nixpkgs-62585a363f21d8101a7eba411d9957e7ac59b863.tar.lz
nixpkgs-62585a363f21d8101a7eba411d9957e7ac59b863.tar.xz
nixpkgs-62585a363f21d8101a7eba411d9957e7ac59b863.tar.zst
nixpkgs-62585a363f21d8101a7eba411d9957e7ac59b863.zip
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.
-rw-r--r--pkgs/lib/modules.nix14
1 files 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 = "<unknown location>"; } // m
       else
-        {
-          key = "<unknown location>";
-          imports = getImportedPaths;
+        { key = "<unknown location>";
+          imports = (m.imports or []) ++ getImportedPaths;
           config = getConfig;
         } // (
           if getImportedSets != [] then