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-srcrustc-devrustfmt: 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.tomlfile 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 updocker build . -t nix-rust-template
docker volume create nix-rust-template-vol
docker run --rm -it -v $PWD:/service nix-rust-template:latestIf you are using Docker, prefix the following with docker compose run --rm app; for example:
docker compose run --rm app nix run .#watchnix build: build the packagenix runornix 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: