4 Commits

Author SHA1 Message Date
tomatocream f07e0c08c8 Fix formatting drift after rename, and document git-init requirement
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
2026-08-11 01:06:58 +08:00
tomatocream c7303154cc Add flake.templates, justfile, and .envrc for direnv
Compared this template against the older nix-templates/templates/rust
("rrrr") ahead of eventually replacing it. Ported the pieces that were
genuinely missing and non-controversial:

- flake.templates.default, so `nix flake init -t <url>` works once
  this repo is published — the actual mechanism a "template" needs.
- justfile wrapping the cargo/nix commands for discoverability.
- .envrc (use flake) for direnv auto-activation.
- `just` added to the dev shell so the justfile is usable without a
  separate install.

Left out on purpose: workspace crate split, tracing/serde/tokio-heavy
example code, docker.nix, nightly coverage toolchain, and copier.yaml —
those make it an opinionated async-service starter rather than a blank
Rust template, and copier.yaml in the old repo was dead configuration
(no file actually referenced its Jinja variables).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ALEXkc7pTro7tF1WcUuKb
2026-08-11 00:50:51 +08:00
tomatocream d61ba8aec2 Add README.md and make the template workflow explicit in CLAUDE.md
README covers the copy-clone-rename-build flow and the simple cargo/nix
run commands. CLAUDE.md now states the intended workflow up front
(rename script, then build whatever the user actually wants) instead
of only implying it via the rename-script section.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ALEXkc7pTro7tF1WcUuKb
2026-08-11 00:28:57 +08:00
tomatocream 6e460aca80 Add CLAUDE.md documenting cargo/nix workflows and architecture
Covers both dev paths (plain cargo vs nix develop/build/flake check),
LSP setup via the fenix toolchain's RUST_SRC_PATH, how nix/rust.nix
is shared between the package build and dev shell, where to add
unit vs integration tests, and how to use the rename script. Includes
a note to keep it updated as the template grows into real functionality.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ALEXkc7pTro7tF1WcUuKb
2026-08-11 00:22:30 +08:00