cachix / git-hooks.nix

Seamless integration of https://pre-commit.com git hooks with Nix.
Apache License 2.0
466 stars 144 forks source link

treefmt settings do not include config or configPath #436

Open JayRovacsek opened 2 months ago

JayRovacsek commented 2 months ago

Currently the treefmt hook does not support a configuration path option that would enable the reference of treefmt.toml. Without running treefmt --init or --config-file the check cannot be utilised in a consistent way if the config file is not committed to the repository

Happy to contribute a PR that adds this if deemed suitable :pray:

roberth commented 2 months ago

The flake-parts module has a special integration that activates when you load both git-hooks.nix and treefmt-nix. Might that help?

It's defined here: https://github.com/cachix/git-hooks.nix/blob/40e6053ecb65fcbf12863338a6dcefb3f55f1bf8/flake-module.nix#L72

JayRovacsek commented 2 months ago

Thanks for the fast response @roberth, unfortunately I don't utilise flake-parts myself (though I might be misunderstanding how I'd consume the flakeModule code)

Would the project be open to a PR that added a setting for config/configFile akin to the implementation for typos? (ref)