| src | ||
| .dir-locals.el | ||
| .envrc | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| channels-lock.scm | ||
| channels.scm | ||
| LICENSE | ||
| Makefile | ||
| manifest.scm | ||
| package.scm | ||
| README.md | ||
Rust template project
This repository provides a template for Rust projects where the development environment is fully managed using GNU Guix.
The project structure is designed to cleany integrate Rust, Guix and Direnv.
Project structure
- src/ Contains the Rust source files.
- Cargo.toml and Cargo.lock Standard Rust/Cargo files defining the package and locking dependency versions.
- .envrc
Configures Direnv to automatically load the development environment defined in
manifest.scmthrough Guix. - .dir-locals.el Local Emacs settings (e.g., integration with Guix, Direnv, and Rust tooling).
- Makefile Provides utility commands; in particular, a target to conveniently update Guix channel references (or lock files).
- package.scm
Defines the project as a Guix package, making it installable on the system.
Dependencies are automatically inferred from
Cargo.lock. - channels.scm Lists the Guix channels used by the project.
- channels-lock.scm Auto-generated file containing the exact revisions of the channels in use.
- manifest.scm Defines the Guix-based development environment.
Development environment
The development environment is defined declaratively in manifest.scm, which lists all required tools and libraries.
By relying on GNU Guix, the project guarantees:
- Reproducibility: everyone uses exactly the same compiler, tools, and library versions.
- Isolated development: the environment does not interfere with system packages.
- Easy onboarding: a single command sets everything up.
The most convenient method to access the development environment is to use direnv on the host machine.
With direnv installed and enabled in your shell, the project directory will automatically load the Guix environment described in manifest.scm upon entry, and unload it when leaving the directory. This avoids running guix shell ... manually each time.
Without direnv, to manually enter in the development environment:
guix time-machine -C channels-lock.scm -- shell -m manifest.scm
Whenever the dependencies change, you can update the development shell with:
make update-env