This is a template repository for rust projects. It features the following:
- Rust Toolchain via a Nix flake with direnv support
- Commit hooks for formatting, linting, and conventional commits via prek
- Opinionated linting configuration
- Multi-stage Dockerfile with cargo-chef dependency caching,
built with
--build-arg SERVICE=<bin> - Branch protection script for the default branch
- GPL and MIT licenses already in-repo
To get started with this template, do the following:
-
Update the
repositoryfield in Cargo.toml -
Ensure the desired rust version is correct in rust-toolchain.toml
-
For each crate you add under
crates/, satisfyclippy::cargoby either settingpublish = false(for binaries or internal-only crates) or providing all of the following[package]fields, since CI runs clippy with-D warnings:descriptionlicenseorlicense_filerepositoryreadmekeywordscategories
Shared values (
edition,license,readme,repository) can be inherited from[workspace.package]viafield.workspace = true;description,keywords, andcategoriesare usually set per-crate. -
Change crate
examplein Justfile to your primary binary if applicable. -
Run
./scripts/protect-main.shto require pull requests, passing CI, and rebase merges onmain. UpdateREQUIRED_CHECKSin the script if you rename a workflow job.
This template is licensed under the MIT License.
Any contribution intentionally submitted for inclusion in this repository shall be licensed as above, without any additional terms or conditions.