summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/types.nix b/lib/types.nix
index bd4062d555a..73f271103fc 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -562,9 +562,13 @@ rec {
       let
         inherit (lib.modules) evalModules;
 
+        shorthandToModule = if shorthandOnlyDefinesConfig == false
+          then value: value
+          else value: { config = value; };
+
         coerce = unify: value: if isFunction value
           then setFunctionArgs (args: unify (value args)) (functionArgs value)
-          else unify (if shorthandOnlyDefinesConfig then { config = value; } else value);
+          else unify (shorthandToModule value);
 
         allModules = defs: imap1 (n: { value, file }:
           if isAttrs value || isFunction value then