Open
Description
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
- For every commit is more useful because like that no extra commits will be necessary just to format
- But for every push would also have advantages, see Treewide Nix reformat pass 1 [skip treewide] nixpkgs#322537 (comment)
- Ideally this could also be together with a rewrite/rebase mode, kind of like https://github.com/grahamc/git-rebase-format/blob/master/git-rebase-format.sh (ref Script to rebase with formatting #159), which would allow users to rebase their PRs, maintaining the same commits, but formatting each of them
- Probably something with
git filter-branch
would be much simpler than that script though
- Probably something with
- It should use the
nixfmt
version pinned in theshell.nix
- It should install itself into
.git/hooks
automatically viashellHook
(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
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Todo