Integrates pre-commit git hooks with Nix for reproducible development environments and CI.
git-hooks.nix is a Nix library that integrates the pre-commit git hook framework with the Nix ecosystem. It solves the problem of managing consistent linter and formatter tooling across development and CI environments by declaratively defining hooks in Nix, ensuring they are built and cached efficiently.
Nix users and developers working on Nix-based projects who want to enforce code quality standards via git hooks without sacrificing performance or reproducibility.
Developers choose git-hooks.nix because it provides a performant, reproducible way to run pre-commit hooks using Nix-managed tooling, eliminating environment inconsistencies and reducing commit latency compared to ad-hoc hook setups.
Seamless integration of https://pre-commit.com git hooks with Nix.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Wires pre-commit hooks directly into Nix development shells (`nix develop`) and CI checks (`nix flake check`), ensuring tooling consistency across environments as demonstrated in the flake example.
Pre-builds all hook tooling in Nix to avoid latency from naive `nix-shell` calls on each commit, a key feature highlighted in the README to reduce overhead.
Includes built-in hooks for dozens of languages and tools like nixfmt, black, and shellcheck, reducing manual configuration effort, with a comprehensive list provided.
Supports defining project-specific hooks with the same schema as pre-defined ones, allowing tailored checks, as shown in the custom hook example with settings like `entry` and `stages`.
Requires familiarity with Nix and its ecosystem, making it inaccessible for teams not already using Nix, and setup involves complex configuration files like flakes or traditional Nix.
The README admits that `nix flake check` runs in a sandbox without write access, making it unsuitable for formatting hooks that need to modify files automatically, forcing workarounds.
Managing hooks through Nix files adds abstraction compared to standard pre-commit YAML, which can be overkill for simple hook setups and increases learning curve.