about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-09-27 16:39:57 +0200
committerRobert Hensing <robert@roberthensing.nl>2022-06-14 17:07:33 +0200
commit907627f6563546c6304703cab94b8cc60b06a12d (patch)
tree4c132c9717f3b75528d9938783e7401f280d2ded /lib
parent79441600c28c755a302f1e78eceb3c452c3bc7c9 (diff)
downloadnixlib-907627f6563546c6304703cab94b8cc60b06a12d.tar
nixlib-907627f6563546c6304703cab94b8cc60b06a12d.tar.gz
nixlib-907627f6563546c6304703cab94b8cc60b06a12d.tar.bz2
nixlib-907627f6563546c6304703cab94b8cc60b06a12d.tar.lz
nixlib-907627f6563546c6304703cab94b8cc60b06a12d.tar.xz
nixlib-907627f6563546c6304703cab94b8cc60b06a12d.tar.zst
nixlib-907627f6563546c6304703cab94b8cc60b06a12d.zip
lib/types: Simplify submoduleWith shorthandOnlyDefinesConfig handling
The module system already uses the parent module's _file as a fallback,
so we don't need to inject the file in a weird way
Diffstat (limited to 'lib')
-rw-r--r--lib/types.nix15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 147b92f784c9..977dd313cf86 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -580,19 +580,10 @@ rec {
       let
         inherit (lib.modules) evalModules;
 
-        shorthandToModule = if shorthandOnlyDefinesConfig == false
-          then value: value
-          else value: { config = value; };
-
         allModules = defs: imap1 (n: { value, file }:
-          if isFunction value
-          then setFunctionArgs
-                (args: lib.modules.unifyModuleSyntax file "${toString file}-${toString (n + extensionOffset)}" (value args))
-                (functionArgs value)
-          else if isAttrs value
-          then
-            lib.modules.unifyModuleSyntax file "${toString file}-${toString (n + extensionOffset)}" (shorthandToModule value)
-          else value
+          if isAttrs value && shorthandOnlyDefinesConfig
+          then { _file = file; config = value; }
+          else { _file = file; imports = [ value ]; }
         ) defs;
 
         base = evalModules {