From 28aeae21269a69ae9721c9c8f9194877799ead69 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 1 Mar 2022 10:37:10 +0100 Subject: [PATCH] lib.modules: Default shorthandOnlyDefinesConfig to true when null --- lib/types.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/types.nix b/lib/types.nix index bd4062d555aa3..73f271103fc4f 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