f07e0c08c8
Found via an end-to-end test of nix flake init -> rename -> nix flake check: renaming can reorder `use` statements alphabetically (e.g. "acme_widget" now sorts before "criterion"), and treefmt's rustfmt (nixpkgs) disagreed with cargo fmt's rustfmt (fenix toolchain) on edition-2024 import grouping, so the formatting check failed right after a clean rename. - nix/treefmt.nix: pin programs.rustfmt.edition = "2024" to match Cargo.toml, so treefmt and cargo fmt agree. - scripts/rename-project.sh: auto-format (cargo fmt, falling back to nix fmt) after renaming, and note that nix commands need git-tracked files. - README.md/CLAUDE.md: document that `nix flake init -t` doesn't git-init for you, and every nix command needs `git add` first. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ALEXkc7pTro7tF1WcUuKb
20 lines
671 B
Nix
20 lines
671 B
Nix
# treefmt-nix module: wires up `nix fmt` and the `formatting` check.
|
|
_: {
|
|
perSystem = _: {
|
|
treefmt = {
|
|
projectRootFile = "flake.nix";
|
|
|
|
# Edition must match Cargo.toml's `edition = "2024"` — otherwise
|
|
# treefmt's rustfmt (from nixpkgs) and `cargo fmt`'s rustfmt (from the
|
|
# fenix toolchain, which reads the edition from Cargo.toml) disagree
|
|
# on import ordering/grouping and fight each other.
|
|
programs.rustfmt.enable = true;
|
|
programs.rustfmt.edition = "2024";
|
|
programs.nixfmt.enable = true;
|
|
programs.deadnix.enable = true;
|
|
programs.statix.enable = true;
|
|
programs.taplo.enable = true;
|
|
};
|
|
};
|
|
}
|