numtide / treefmt-nix

treefmt nix configuration
https://numtide.github.io/treefmt/
MIT License
247 stars 75 forks source link

[flake-parts] Add a `devShell` option exposing all programs #65

Closed srid closed 1 year ago

srid commented 1 year ago

When using haskell-flake, I manually have to pull in the programs into the devShell:

          devShell = {
            tools = hp: {
              treefmt = config.treefmt.build.wrapper;
            } // config.treefmt.build.programs;
          }

cf. https://github.com/srid/haskell-template/blob/fc263b19e4ef02710ffc61fc656aec6c1a873974/flake.nix#L31-L33


But we can do this in a cleaner way, using inputFrom of mkShell. See https://haskell.flake.page/devshell#composing-devshells

To that end, I'd like a config.treefmt.build.devShell option to be added, that I can then pass into inputsFrom thereby getting both the wrapper and the underlying programs in the devShell. Happy to open a PR if this is acceptable.

https://github.com/numtide/treefmt-nix/blob/6d8bea2820630576ad8c3a3bde2c95c38bcc471f/module-options.nix#L85-L86