flake: format the tree with one treefmt

The pre-commit hooks kept their own list of formatters, so nixpkgs-fmt in
a hook and nixfmt in the check disagreed the moment flake-checks moved.
`nix fmt` is now built from the same treefmt module the formatting check
is, and the hook and the Makefile both call it.
This commit is contained in:
Kristoffer Dalby
2026-09-10 05:33:45 +00:00
parent f1186d8e00
commit d59c1ed209
5 changed files with 28 additions and 19 deletions
+7 -13
View File
@@ -32,21 +32,15 @@ repos:
# Local hooks for project-specific tooling
- repo: local
hooks:
# nixfmt for Nix files; the same formatter the flake's treefmt check
# runs, so the hook and the check cannot disagree.
- id: nixfmt
name: nixfmt
entry: nixfmt
language: system
files: \.nix$
# Prettier for formatting
- id: prettier
name: prettier
entry: prettier --write --list-different
# One formatter for Nix and markup, built from the same treefmt module as
# the flake's formatting check, so the hook and the check cannot disagree.
# Go is absent on purpose: golangci-lint owns it, below.
- id: treefmt
name: treefmt
entry: nix fmt --
language: system
exclude: ^docs/
types_or: [javascript, jsx, ts, tsx, yaml, json, html, css, scss, sass, markdown]
types_or: [javascript, jsx, ts, tsx, yaml, json, html, css, scss, sass, markdown, nix]
# mdformat for docs
- id: mdformat