A reasonable way to start developing a reproducible Rust project.
This reproducibility is enabled by Nix and Docker.
This is a template repository; everything is customizable, and some helpful defaults are included.
- Default rust extensions:
clippy-preview
: A collection of lints to catch common mistakes and improve your Rust coderust-src
rustc-dev
rustfmt
: A tool for formatting Rust code according to style guidelines
- Default dev tools:
rust-analyzer
: Excellent IDE supportcargo-watch
: Watches over your project's source for changes, and runs Cargo commands when they occurcargo-edit
: Extends Cargo to allow you to add, remove, and upgrade dependencies by modifying yourCargo.toml
file from the command line
naersk
: Nix support for building cargo cratesoxalica/rust-overlay
: Pure and reproducible overlay for binary distributed rust toolchains
docker compose build
docker compose up
docker build . -t nix-rust-template
docker volume create nix-rust-template-vol
docker run --rm -it -v $PWD:/service nix-rust-template:latest
If you are using Docker, prefix the following with docker compose run --rm app
; for example:
docker compose run --rm app nix run .#watch
nix build
: build the packagenix run
ornix run .#app
: run the packagenix run .#watch
: watch the package for changes and rerunnix develop
: enter a reproducible rust shell environment- How to watch for changes and rerun:
cargo watch -w "./src/" -x "run"
- How to watch for changes and rerun: