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
This commit is contained in:
2026-08-11 00:50:51 +08:00
parent d61ba8aec2
commit c7303154cc
6 changed files with 100 additions and 2 deletions
+6 -1
View File
@@ -6,7 +6,7 @@ way with plain `cargo` or with `nix`.
## Using this template
1. Copy/clone this repo.
1. Copy/clone this repo (or, once published, `nix flake init -t <this-repo-url>`).
2. Rename the placeholder crate name:
```bash
./scripts/rename-project.sh my_project
@@ -34,4 +34,9 @@ nix flake check # clippy, fmt, doc, audit, tests — all in one go
nix fmt # format Rust, Nix, and TOML files
```
If you have [direnv](https://direnv.net/) installed, `direnv allow` activates the dev shell
automatically on `cd` (see `.envrc`).
`just` (available inside `nix develop`) wraps the common commands above — run `just` to list them.
See `CLAUDE.md` for more detail on the project layout and how the pieces fit together.