summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-03-01 10:45:46 +0100
committerRobert Hensing <robert@roberthensing.nl>2022-03-03 00:29:15 +0100
commit20506699226b0dac5d423c6f6249f3cb15565169 (patch)
treee241aa6906d37856b17be85f92f69a4a3ad7112f /lib/types.nix
parent28aeae21269a69ae9721c9c8f9194877799ead69 (diff)
lib.modules: Inline a private function
This should save about four calls per module.
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 73f271103fc4f..d2c109cabe813 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -566,14 +566,14 @@ rec {
           then value: value
           else value: { config = value; };
 
-        coerce = unify: value: if isFunction value
-          then setFunctionArgs (args: unify (value args)) (functionArgs value)
-          else unify (shorthandToModule value);
-
         allModules = defs: imap1 (n: { value, file }:
-          if isAttrs value || isFunction value then
-            # Annotate the value with the location of its definition for better error messages
-            coerce (lib.modules.unifyModuleSyntax file "${toString file}-${toString n}") value
+          if isFunction value
+          then setFunctionArgs
+                (args: lib.modules.unifyModuleSyntax file "${toString file}-${toString n}" (value args))
+                (functionArgs value)
+          else if isAttrs value
+          then
+            lib.modules.unifyModuleSyntax file "${toString file}-${toString n}" (shorthandToModule value)
           else value
         ) defs;