flake-parts
flake-parts copied to clipboard
Auto-wiring
Modules can provide various levels of integration, where an integration is any definition that isn't of a function that it declares.
Sometimes, integrations are not desirable. Making integrations lib.mkDefault
may help, but this may not always be sufficient. If it turns out that some flakes need to disable too many integrations explicitly, perhaps it makes sense to introduce a single global option that disables all integrations. All (reusable) modules should then adhere to that option.
The story of a flake would then be
- initialize a flake with flake-parts
- add some modules with integrations
- use the integrations
- add a module with undesirable integration
- configure that module to disable that integration (?)
- encounter another undesirable integration
- set
autoWire = false
- write the missing integrations that they did need
Perhaps modules could list their integrations in another option, to help with (8), but all in all it's not a great experience. I would consider this idea to be a last resort; I hope we'll find better solutions.
I just had an use-case for granular auto-wiring: https://github.com/srid/haskell-flake/issues/142
Another: https://github.com/Platonic-Systems/process-compose-flake/issues/27
Projects (TBD) might provide an alternative
- https://github.com/hercules-ci/flake-parts/issues/205
Another: https://github.com/juspay/rust-flake/pull/13
Another: https://nixos-unified.org/autowiring.html