About crate2nix
crate2nix produces Nix build files for Rust projects that use Cargo. Rather than building a project as one unit, it creates a separate Nix derivation for each crate, so only the crates that changed need rebuilding. It is aimed at teams that use Nix and want finer-grained builds and caching for Rust code.
It reads Cargo.toml and Cargo.lock, resolves the dependency tree through cargo metadata, prefetches source hashes and renders a Cargo.nix file from templates. Generation can be manual, which avoids import-from-derivation and keeps full parallelism, or automatic, which stays in sync with the lockfile. An experimental JSON output moves feature resolution into Rust.
Day-to-day development is unchanged because you keep using cargo and rust-analyzer. On the Nix side it integrates with remote builds, binary caches, Docker images and NixOS modules, and tools.nix exposes helpers for your own expressions. It is maintained under the nix-community organization and licensed Apache-2.0.
Key features
- Per-crate Nix derivations for incremental rebuilds
- Generates Cargo.nix from Cargo.lock
- Manual or import-from-derivation generation
- Experimental JSON output format
- Works with binary caches and remote builds
- Nix helper functions via tools.nix
Good fit for
- โSpeeding up Rust CI with Nix caching
- โPackaging Rust applications for NixOS
- Tags
- nix
- rust
- cargo
- build-system
- ci
- nixos
- caching
crate2nix: questions and answers
- What is crate2nix used for?
- crate2nix is a tool that generates Nix build files from a Cargo project so each Rust crate is built separately, enabling incremental CI builds and caching with Nix. It is a good fit for speeding up Rust CI with Nix caching and packaging Rust applications for NixOS.
- Is crate2nix open source?
- Yes. crate2nix is open source under the Apache-2.0 licence. Its source code is on GitHub at nix-community/crate2nix and is written mainly in Nix.
- Is crate2nix free?
- Yes. crate2nix is open source, so the software itself is free to use.
- What are some alternatives to crate2nix?
- Similar open-source tools in the Developer Tools category include Tach, Zed and Helix. SaaS products in the same category include RustRover, BuildBuddy and Develocity.
- Is crate2nix actively maintained?
- Yes. The most recent commit to crate2nix was on 30 September 2026, and the latest release is 0.15.0, published on 28 January 2026. The project has 524 stars on GitHub.
Open-source alternatives to crate2nix
See all
Tach
Developer Tools
A Python tool to visualize + enforce dependencies, using modular architecture ๐ Open sour
MITโ 2.8k
Zed
Developer Tools
Code at the speed of thought โ Zed is a high-performance, multiplayer code editor from the
OSSvs Sublime Textโ 91k
Helix
Developer Tools
A post-modern modal text editor.
MPL-2.0vs Sublime Textโ 46k
Google Workspace CLI
Developer Tools
Google Workspace CLI โ one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Cha
Apache-2.0โ 31k
WezTerm
Developer Tools
A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and imp
OSSvs Warpโ 29k
Alacritty
Developer Tools
A cross-platform, OpenGL terminal emulator.
Apache-2.0vs Warpโ 66k
SaaS alternatives to crate2nix
See all
RustRover
Developer Tools
JetBrains IDE for Rust development
SaaS
BuildBuddy
Developer Tools
Remote build caching, execution and results UI for Bazel
SaaS
Develocity
Developer Tools
Build and test acceleration and analytics platform for Gradle and Maven builds
SaaS
Qodana
Developer Tools
JetBrains static analysis tool that brings IDE inspections to CI pipelines
SaaS
1DevTool
Developer Tools
Desktop workspace for running several AI coding agents side by side across multiple projects
SaaS
3 Pixel Grid
Developer Tools
Library of tiny animated 3x3 grid indicators with copyable configs for use in your own project
SaaS

