diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-13 14:39:45 -0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-13 15:15:16 -0400 |
commit | 0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7 (patch) | |
tree | 5da3663755e9968c4037e3ca54753457effe311b /pkgs | |
parent | c68c95d55a268d06943bb9c6456a3499d1e47124 (diff) | |
download | nixlib-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar nixlib-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.gz nixlib-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.bz2 nixlib-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.lz nixlib-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.xz nixlib-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.tar.zst nixlib-0b4fb4e4f6fde92b0432fa4d97becf6215ec7be7.zip |
Replace some calls to attrByPath with "or"
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/lib/modules.nix | 10 | ||||
-rw-r--r-- | pkgs/lib/options.nix | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/pkgs/lib/modules.nix b/pkgs/lib/modules.nix index 13be0daa2877..25cb956a0ea4 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; diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix index 05c9c5f9c0f5..59bda41a623f 100644 --- a/pkgs/lib/options.nix +++ b/pkgs/lib/options.nix @@ -152,13 +152,11 @@ rec { opt1 // opt2 // optionalAttrs (opt1 ? options || opt2 ? options) { options = - (toList (attrByPath ["options"] [] opt1)) - ++ (toList (attrByPath ["options"] [] opt2)); + (toList (opt1.options or [])) + ++ (toList (opt2.options or [])); } // optionalAttrs (opt1 ? extraConfigs || opt2 ? extraConfigs) { - extraConfigs = - (attrByPath ["extraConfigs"] [] opt1) - ++ (attrByPath ["extraConfigs"] [] opt2); + extraConfigs = opt1.extraConfigs or [] ++ opt2.extraConfigs or []; } )) {} opts; |