Files
nixos/treefmt.toml
T
oqyude 22d29e52ba docs: правильный синтаксис nix develop .#fmt — без лишнего --
Тест поймал: задокументированная команда гейта была сломана.

  nix develop .#fmt --command treefmt -- --fail-on-change .
  -> Error: failed to create walker: path .../--fail-on-change not found

`nix develop --command` передаёт разделитель `--` самому treefmt'у как
позиционный аргумент, и тот считает его именем каталога. Правильно:

  nix develop .#fmt --command treefmt --fail-on-change .      # exit 0
  nix develop .#fmt --command bash -c 'treefmt --fail-on-change .'  # тоже

Попутно подтверждено: полный `nix flake check` (с билдом) на этой ветке
проходит — exit 0, all checks passed, включая checks.deploy-schema и
checks.deploy-activate. И devshell .#fmt собирается: в PATH treefmt, nixfmt,
shfmt и shellcheck.
2026-11-15 23:08:17 +03:00

43 lines
1.8 KiB
TOML

# treefmt configuration — one entry point for every formatter in the repo.
#
# How to use it:
# nix develop .#fmt --command treefmt # apply the style
# nix develop .#fmt --command treefmt --fail-on-change . # CI-style gate
#
# Лишний `--` перед флагами НЕ нужен: `nix develop --command` передаёт его
# treefmt'у как позиционный аргумент, и тот падает с
# "failed to create walker: path .../--fail-on-change not found".
# Проверено 2026-11-15.
#
# There is deliberately NO `formatter` output in flake.nix: on the pinned
# nixpkgs `nix flake check` fails with "'outPath' is not a valid system type"
# on any derivation output, so the formatter lives in a devshell instead
# (see the note in flake.nix and ADR-0011).
#
# Current state (measured 2026-11-15):
# * all 138 tracked .nix files are nixfmt-clean — the formatter guards
# against future drift, it does not reformat the repository;
# * the repository's own shell scripts are shfmt-clean;
# * .agent/src/install.sh is EXCLUDED below: it predates the formatter and
# was never shfmt-formatted (487 diff lines). Reformatting somebody
# else's installer is the owner's call, not the formatter's.
#
# Deliberately absent: a JSON/YAML formatter. The .agent artefacts are
# hand-written and reformatting them would bury every real diff in noise.
# ShellCheck is a linter, not a formatter — it runs as its own check
# (see check #13 in .ci/checks.sh).
[global]
# A formatter that fails must not stop the others: report and continue.
onfail = "append"
[formatter.nixfmt]
command = "nixfmt"
includes = ["**/*.nix"]
[formatter.shfmt]
command = "shfmt"
args = ["-i", "2", "-ci", "-w"]
includes = ["**/*.sh"]
excludes = [".agent/src/install.sh"]