A modern Rust workspace template using Nix + direnv + crane + rust-overlay. Ready to use out of the box.
- Reproducible builds - Nix flakes ensure reproducibility
- Fast incremental builds - crane dependency caching speeds up CI
- Workspace ready - Pre-configured multi-crate structure
- Auto environment - nix-direnv automatic environment loading
- CI ready - Built-in clippy, fmt, test, audit, deny checks
- Deploy ready - Includes home-manager module examples
.
├── flake.nix # Flake entry point
├── nix/
│ ├── common.nix # Core config (crate paths, dependencies)
│ ├── packages.nix # Flake output packages
│ └── dev/
│ ├── shell.nix # Development environment
│ └── checks.nix # CI checks
└── crates/ # Rust workspace
# Use as GitHub template, then clone your new repo
# Option 1: Manual dev shell
nix develop
# Option 2: direnv auto-loading (recommended)
direnv allow
# Build
nix build
# Run all checks
nix flake checkThe project includes .envrc for direnv automatic environment loading.
Installation:
- NixOS: See NixOS Wiki - direnv
- Other systems: See direnv docs
Usage:
-
Allow in project:
direnv allow
-
Dev shell activates automatically when entering the directory; IDEs recognize correct tool versions
nix flake check runs the following:
| Check | Description |
|---|---|
*-clippy |
Lint (warnings as errors) |
*-fmt |
Code format check |
*-toml-fmt |
TOML format check |
*-doc |
Doc build (warnings as errors) |
*-nextest |
Test runner |
*-audit |
Security audit |
*-deny |
License and dependency checks |