We should have this in Nixpkgs for NixOS/nixpkgs#326407. Here are some notes for that:
- For every push/commit, it should verify that changed and new files are formatted
- It should use the
nixfmt version pinned in the shell.nix
- It should install itself into
.git/hooks automatically via shellHook (this is also how https://github.com/cachix/git-hooks.nix works)
- Not a requirement, but ideally it would share as much with the GitHub Action workflow as possible. It's notably fairly easy to get another Git checkout of the base branch.
Ping @emilazy
We should have this in Nixpkgs for NixOS/nixpkgs#326407. Here are some notes for that:
git filter-branchwould be much simpler than that script thoughnixfmtversion pinned in theshell.nix.git/hooksautomatically viashellHook(this is also how https://github.com/cachix/git-hooks.nix works)Ping @emilazy