Auto-import partition-exclusive flakeModules in mkPartitionModule
Problem
mkPartitionModule cannot naively auto-import flakeModule from all partition inputs because partitions use extendModules, which inherits all modules from the main evaluation. Re-importing modules already present in the main eval causes duplicate option declarations due to flake-parts' flake.modules.flake option wrapping imports with route-qualified _file paths (defeating the module system's key-based dedup).
Error example:
error: The option 'partitions.dev.module.nixica.formatting.enable' in
'nixica-formatting.nix, via option flake.modules.flake.nixica-formatting'
is already declared in
'nixica-formatting.nix, via option flake.modules.flake.nixica-formatting'
Proposed solution
Auto-import only partition-exclusive inputs — inputs present in the partition's extraInputsFlake but absent from the main flake's inputs. This requires mkPartitionModule to know the main flake's input names, which can be passed via the module args or as an explicit parameter.
This would eliminate the need for consumers to manually write imports = [ inputs.gitlab-ci.flakeModule ] in their partition module.
Related
- Merged in !6 (merged) (auto-import in
mkFlake) - Discussion in #6 (closed)
- Root cause: flake-parts
flake.modules.flakeoption defeats NixOS module system key-based dedup — potentially worth raising upstream with hercules-ci