diff --git a/lib/default.nix b/lib/default.nix index 3fead03a4636..1746efc68196 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -112,7 +112,7 @@ let commitIdFromGitRepo cleanSourceWith pathHasContext canCleanSource pathIsRegularFile pathIsGitRepo; inherit (self.modules) evalModules setDefaultModuleLocation - unifyModuleSyntax applyIfFunction mergeModules + unifyModuleSyntax applyModuleArgsIfFunction mergeModules mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions pushDownProperties dischargeProperties filterOverrides sortProperties fixupOptionType mkIf mkAssert mkMerge mkOverride diff --git a/lib/modules.nix b/lib/modules.nix index 4c4d9f994dae..46739746e627 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -268,11 +268,11 @@ rec { # Like unifyModuleSyntax, but also imports paths and calls functions if necessary loadModule = args: fallbackFile: fallbackKey: m: if isFunction m || isAttrs m then - unifyModuleSyntax fallbackFile fallbackKey (applyIfFunction fallbackKey m args) + unifyModuleSyntax fallbackFile fallbackKey (applyModuleArgsIfFunction fallbackKey m args) else if isList m then let defs = [{ file = fallbackFile; value = m; }]; in throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}" - else unifyModuleSyntax (toString m) (toString m) (applyIfFunction (toString m) (import m) args); + else unifyModuleSyntax (toString m) (toString m) (applyModuleArgsIfFunction (toString m) (import m) args); /* Collects all modules recursively into the form @@ -369,7 +369,7 @@ rec { config = addFreeformType (addMeta (removeAttrs m ["_file" "key" "disabledModules" "require" "imports" "freeformType"])); }; - applyIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then + applyModuleArgsIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then let # Module arguments are resolved in a strict manner when attribute set # deconstruction is used. As the arguments are now defined with the