pre-commit manages a set of hooks that are executed by git before committing code:
Common hooks range from static analysis or linting to source formatting.
Since we’re managing quite a couple of repositories, maintaining the duplicated definitions became a burden.
Hence we created:
The goal is to manage these hooks with Nix and solve the following:
Simpler integration into Nix projects, doing the wiring up behind the scenes
Provide a low-overhead build of all the tooling available for the hooks to use (calling nix-shell for every check does bring some latency when committing)
Common package set of hooks for popular languages like Haskell, Elm, etc.
Two trivial Nix functions to run hooks as part of development and on your CI
Currently the following hooks are provided:
- canonix: a Nix formatter (currently incomplete, requiring some manual formatting as well)
- elm-format source formatter
- shellcheck bash linter
We encourage everyone to contribute additional hooks.
See project’s README for latest up-to-date installation steps.