chore(nix): migrate pre-commit runner to prek#957
Merged
cpcloud merged 1 commit intomicasa-dev:mainfrom Apr 19, 2026
Merged
Conversation
Swap python-based pre-commit for prek via git-hooks.nix's `package` option. Two caveats worked around in `flake.nix`: - Upstream git-hooks.nix hardcodes `prek install` without `--git-dir`, which breaks in git worktrees where `.git` is a file. A shim injects `--git-dir` from `git rev-parse --git-common-dir` for install calls. - prek 0.3.9+ rejects empty `core.hooksPath` (git resolves "" to "."). Patch the generated shellHook to `--unset core.hooksPath` instead. The shim also passes `--overwrite` so reinstalls are silent. prek 0.3.8's `uninstall` subcommand rejects `--git-dir`, so the shim only adds the flag on `install`; the subsequent overwrite install supersedes any stale hook left behind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pre-commitbinary forprek(Rust rewrite, drop-incompatible) via git-hooks.nix's
packageoptionprek installcalls to inject--git-dirand--overwritesohook install works in git worktrees and stays quiet on reinstall
--unset core.hooksPathinstead ofsetting it to
"", which prek 0.3.9+ rejectsrun-pre-commitapp now invokesprek run; CI (nix run '.#pre-commit')picks up the change transparently