Skip to content
Proyectos

srid/rust-nix-template

Ver en GitHub

Acerca de

Rust project template with Nix (Flakes) and VSCode support

Herramientas de desarrollo

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

A template Rust project with fully functional and no-frills Nix support, as well as builtin VSCode configuration to get IDE experience without any manual setup (just install direnv, open in VSCode and accept the suggestions). It uses crane, via rust-flake.

[!NOTE] If you are looking for the original template based on this blog post's use of crate2nix, browse from this tag. The evolution of this template can be gleaned from releases.

Usage

You can use omnix[^omnix] to initialize this template:

nix run nixpkgs#omnix -- init github:srid/rust-nix-template -o ~/my-rust-project

[^omnix]: If initializing manually, make sure to: - Change name in Cargo.toml. - Run cargo generate-lockfile in the nix shelld

Adapting this template

  • There are two CI workflows, and one of them uses Nix which is slower (unless you configure a cache) than the other one based on rustup. Pick one or the other depending on your trade-offs.

Development (Flakes)

This repo uses Flakes from the get-go.

# Dev shell
nix develop

# or run via cargo
nix develop -c cargo run

# build
nix build

We also provide a justfile for Makefile'esque commands to be run inside of the devShell.

Tips

  • Run nix flake update to update all flake inputs.
  • Run nix --accept-flake-config run github:juspay/omnix ci to build all outputs.
  • [pre-commit] hooks will automatically be setup in Nix shell. You can also run pre-commit run -a manually to run the hooks (e.g.: to autoformat the project tree using rustfmt, nixpkgs-fmt, etc.).

Discussion

See Also

Explorar proyectos relacionados

Cargando…