Commit 907627f6 authored by Silvan Mosberger's avatar Silvan Mosberger Committed by Robert Hensing
Browse files

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
parent 79441600
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -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 {