Add treefmt formatter (nix fmt + flake check gate)

This commit is contained in:
Berwn
2026-06-16 16:46:14 +07:00
parent 3302b70485
commit cf0d796bee
3 changed files with 81 additions and 14 deletions
+32
View File
@@ -0,0 +1,32 @@
# treefmt config, evaluated per-system in flake.nix and exposed as
# `nix fmt` (the formatter) plus a `nix flake check` formatting gate.
{ ... }:
{
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
prettier.enable = true;
yamlfmt.enable = true;
shfmt.enable = true;
};
settings = {
on-unmatched = "fatal";
global.excludes = [
# Secrets and clan-managed state — never reformat.
"sops/*"
"vars/*"
"inventory.json"
# Generated — don't reformat (regeneration would churn the diff).
"*facter.json"
# No formatter, or reformatting would corrupt them.
"*.zone" # Knot zone files
"flake.lock"
".envrc"
".gitignore"
];
};
}