diff options
author | Robert Hensing <robert@roberthensing.nl> | 2022-03-01 10:37:10 +0100 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2022-03-03 00:29:14 +0100 |
commit | 28aeae21269a69ae9721c9c8f9194877799ead69 (patch) | |
tree | f2da84d8788cccf6e5c94f054190171f684f25c9 /lib/types.nix | |
parent | 6b077c47ff14cb9a4a8f5cb8986fa83ff626c732 (diff) | |
download | nixpkgs-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/types.nix')
-rw-r--r-- | lib/types.nix | 6 |
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 |