about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/modules.nix8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index 091c72e30aae3..c68bbfcaa3e01 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -444,10 +444,10 @@ rec {
       */
       byName = attr: f: modules:
         zipAttrsWith (n: concatLists)
-          (map (module:
-              if !(builtins.isAttrs module.${attr}) then
+          (map (module: let subtree = module.${attr}; in
+              if !(builtins.isAttrs subtree) then
                 throw ''
-                  You're trying to declare a value of type `${builtins.typeOf module.${attr}}'
+                  You're trying to declare a value of type `${builtins.typeOf subtree}'
                   rather than an attribute-set for the option
                   `${builtins.concatStringsSep "." prefix}'!
 
@@ -456,7 +456,7 @@ rec {
                   this option by e.g. referring to `man 5 configuration.nix'!
                 ''
               else
-                mapAttrs (n: f module) module.${attr}
+                mapAttrs (n: f module) subtree
               ) modules);
       # an attrset 'name' => list of submodules that declare ‘name’.
       declsByName = byName "options" (module: option: