Open DavHau opened 2 years ago
the pre commit hook when installed correctly runs on the git repo on changed/added files if your hook runs on a store path, the setup is completely wrong, it must run on the real path
run
") is meant for CI to guarantee a complete check.In my view that covers all use cases.
Something based on nix run
would be a slower version of what the actual pre-commit
command and the actual hooks do for you. The only benefit I see to this is that if you always regenerate the config file, it can't go stale, but stale config isn't a problem because you the guaranteed complete and up to date check in CI.
I guess this needs to be explained in docs?
I'm currently trying to set up a hook for a flake to run treefmt only on changed files. With flakes nix always removes the
.git
directory before even starting the evaluation. Therefore there is no chance for the hook to learn about which files have been changed.One solution could be to support
nix run
based checks.