flake-parts icon indicating copy to clipboard operation
flake-parts copied to clipboard

Auto-wiring

Open roberth opened this issue 2 years ago • 4 comments

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

  1. initialize a flake with flake-parts
  2. add some modules with integrations
  3. use the integrations
  4. add a module with undesirable integration
  5. configure that module to disable that integration (?)
  6. encounter another undesirable integration
  7. set autoWire = false
  8. 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.

roberth avatar Feb 01 '23 13:02 roberth

I just had an use-case for granular auto-wiring: https://github.com/srid/haskell-flake/issues/142

srid avatar Apr 11 '23 17:04 srid

Another: https://github.com/Platonic-Systems/process-compose-flake/issues/27

srid avatar Jun 29 '23 17:06 srid

Projects (TBD) might provide an alternative

  • https://github.com/hercules-ci/flake-parts/issues/205

roberth avatar Jan 29 '24 18:01 roberth

Another: https://github.com/juspay/rust-flake/pull/13

srid avatar Jul 13 '24 16:07 srid

Another: https://nixos-unified.org/autowiring.html

srid avatar Oct 05 '24 14:10 srid