diff options
author | Robert Hensing <robert@roberthensing.nl> | 2022-04-24 00:07:59 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2022-04-24 00:07:59 +0200 |
commit | 224426ba6d4370ede958c127d9b9866a189522f9 (patch) | |
tree | 6c7acf114ed5e73c23ff114c41f60a5395942476 /lib/modules.nix | |
parent | 3ca4a1714a8990158dd69ca557248b121cbdc973 (diff) |
lib.types.submoduleWith: Avoid _key collisions after extendModules
Diffstat (limited to 'lib/modules.nix')
-rw-r--r-- | lib/modules.nix | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index abcdd1a894cca..0b3560a126615 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -113,6 +113,10 @@ rec { args ? {} , # This would be remove in the future, Prefer _module.check option instead. check ? true + # Internal variable to avoid `_key` collisions regardless + # of `extendModules`. Used in `submoduleWith`. + # Test case: lib/tests/modules, "168767" + , extensionOffset ? 0 }: let withWarnings = x: @@ -338,15 +342,17 @@ rec { modules ? [], specialArgs ? {}, prefix ? [], + extensionOffset ? length modules, }: evalModules (evalModulesArgs // { modules = regularModules ++ modules; specialArgs = evalModulesArgs.specialArgs or {} // specialArgs; prefix = extendArgs.prefix or evalModulesArgs.prefix; + inherit extensionOffset; }); type = lib.types.submoduleWith { - inherit modules specialArgs; + inherit modules specialArgs extensionOffset; }; result = withWarnings { |