summary refs log tree commit diff
path: root/pkgs/lib/modules.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-13 14:39:45 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-13 15:15:16 -0400
commit0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7 (patch)
tree5da3663755e9968c4037e3ca54753457effe311b /pkgs/lib/modules.nix
parentc68c95d55a268d06943bb9c6456a3499d1e47124 (diff)
downloadnixpkgs-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar
nixpkgs-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.gz
nixpkgs-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.bz2
nixpkgs-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.lz
nixpkgs-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.xz
nixpkgs-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.zst
nixpkgs-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.zip
Replace some calls to attrByPath with "or"
Diffstat (limited to 'pkgs/lib/modules.nix')
-rw-r--r--pkgs/lib/modules.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkgs/lib/modules.nix b/pkgs/lib/modules.nix
index 13be0daa287..25cb956a0ea 100644
--- a/pkgs/lib/modules.nix
+++ b/pkgs/lib/modules.nix
@@ -44,9 +44,9 @@ rec {
       delayedModule = delayProperties m;
       getImports =
         if m ? config || m ? options then
-          attrByPath ["imports"] [] m
+          m.imports or []
         else
-          toList (rmProperties (attrByPath ["require"] [] delayedModule));
+          toList (rmProperties (delayedModule.require or []));
 
       getImportedPaths = filter isPath getImports;
       getImportedSets = filter (x: !isPath x) getImports;
@@ -92,7 +92,7 @@ rec {
             else newModuleName origin index;
         };
 
-      getImports = m: attrByPath ["imports"] [] m;
+      getImports = m: m.imports or [];
 
       newModuleName = origin: index:
         "${origin.key}:<import-${toString index}>";
@@ -110,8 +110,8 @@ rec {
   selectDeclsAndDefs = modules:
     lib.concatMap (m:
       if m ? config || m ? options then
-         [ (attrByPath ["options"] {} m) ]
-      ++ [ (attrByPath ["config"] {} m) ]
+         [ (m.options or {}) ]
+      ++ [ (m.config or {}) ]
       else
         [ m ]
     ) modules;