diff options
Diffstat (limited to 'lib/modules.nix')
-rw-r--r-- | lib/modules.nix | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 46ae3f136310b..b2ae51c8e618a 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -430,10 +430,16 @@ rec { # an attrset 'name' => list of unmatched definitions for 'name' unmatchedDefnsByName = - # Propagate all unmatched definitions from nested option sets - mapAttrs (n: v: v.unmatchedDefns) resultsByName - # Plus the definitions for the current prefix that don't have a matching option - // removeAttrs defnsByName' (attrNames matchedOptions); + if configs == [] + then + # When no config values exist, there can be no unmatched config, so + # we short circuit and avoid evaluating more _options_ than necessary. + {} + else + # Propagate all unmatched definitions from nested option sets + mapAttrs (n: v: v.unmatchedDefns) resultsByName + # Plus the definitions for the current prefix that don't have a matching option + // removeAttrs defnsByName' (attrNames matchedOptions); in { inherit matchedOptions; |