git-hooks.nix icon indicating copy to clipboard operation
git-hooks.nix copied to clipboard

Per-hook flake output `check` derivations

Open gekoke opened this issue 1 year ago • 1 comments

It would be nice if each hook could be built as a separate derivation. Currently, only one flake check output with the name pre-commit is produced.

If the hooks could be split into separate derivations, one could:

  • run each check separately
  • run checks in parallel in CI with tools like https://github.com/nix-community/nix-github-actions
  • get more granular feedback for CI checks from GitHub's web UI

Is this something that is possible to implement? I understand there is the upstream dependency on pre-commit-hooks that might come into play here.

gekoke avatar Apr 24 '24 13:04 gekoke

I suppose so. One thing to keep in mind is that there'll be a setup cost to pay for each check, not to mention the cost of launching a whole new job for each check. https://github.com/cachix/git-hooks.nix/blob/6fb82e44254d6a0ece014ec423cb62d92435336f/modules/pre-commit.nix#L54-L82

sandydoo avatar Apr 25 '24 11:04 sandydoo