summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-03-01 10:37:10 +0100
committerRobert Hensing <robert@roberthensing.nl>2022-03-03 00:29:14 +0100
commit28aeae21269a69ae9721c9c8f9194877799ead69 (patch)
treef2da84d8788cccf6e5c94f054190171f684f25c9 /lib
parent6b077c47ff14cb9a4a8f5cb8986fa83ff626c732 (diff)
downloadnixpkgs-28aeae21269a69ae9721c9c8f9194877799ead69.tar
nixpkgs-28aeae21269a69ae9721c9c8f9194877799ead69.tar.gz
nixpkgs-28aeae21269a69ae9721c9c8f9194877799ead69.tar.bz2
nixpkgs-28aeae21269a69ae9721c9c8f9194877799ead69.tar.lz
nixpkgs-28aeae21269a69ae9721c9c8f9194877799ead69.tar.xz
nixpkgs-28aeae21269a69ae9721c9c8f9194877799ead69.tar.zst
nixpkgs-28aeae21269a69ae9721c9c8f9194877799ead69.zip
lib.modules: Default shorthandOnlyDefinesConfig to true when null
Diffstat (limited to 'lib')
-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