Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Nix
  3. nix-cargo-integration

nix-cargo-integration

MITNix

A flake-parts module that integrates Cargo projects with Nix using dream2nix for building and development shells.

Visit WebsiteGitHubGitHub
217 stars26 forks0 contributors

What is nix-cargo-integration?

nix-cargo-integration is a Nix library that simplifies integrating Cargo-based Rust projects with the Nix package manager and build system. It uses dream2nix to handle building Rust packages and setting up development shells, solving the problem of managing Rust dependencies and environments reproducibly within Nix.

Target Audience

Rust developers and Nix users who want to integrate Cargo projects into Nix workflows for reproducible builds, dependency management, and development environments.

Value Proposition

Developers choose nix-cargo-integration because it provides a streamlined, opinionated setup with sensible defaults, reducing the complexity of combining Cargo and Nix while leveraging dream2nix for reliable builds and shells.

Overview

Library to easily and effortlessly integrate Cargo projects with Nix.

Use Cases

Best For

  • Integrating existing Cargo projects into Nix flake-based workflows
  • Setting up reproducible development shells for Rust workspaces
  • Managing Rust dependencies with Nix for consistent builds
  • Automating Cargo.lock handling in Nix evaluations
  • Using dream2nix to build Rust packages in Nix
  • Adding Rust projects to flake-parts configurations

Not Ideal For

  • Projects not using or planning to adopt Nix flakes, as it's tightly integrated with flake-parts
  • Simple, single-crate Rust applications where the overhead of Nix integration isn't justified
  • Teams that rely heavily on Cargo's native tooling and prefer minimal ecosystem changes
  • Environments where Cargo.lock is intentionally git-ignored and manual handling is preferred

Pros & Cons

Pros

Dream2nix Backend

Leverages dream2nix to reliably build Rust packages and set up development shells, ensuring reproducible builds within Nix without manual configuration.

Flake-parts Module

Integrates seamlessly as a flake-parts module, allowing easy addition to existing Nix configurations that use flake-parts, as shown in the installation examples.

Sensible Defaults

Comes with pre-configured settings aimed at compatibility with standard Cargo workflows, reducing the need for extensive manual setup.

Automated Lockfile Management

Provides tools to generate and handle Cargo.lock files, addressing common evaluation issues in Nix, as detailed in the tips section for git-ignored lockfiles.

Cons

Nix Flakes Dependency

Requires adoption of Nix flakes and flake-parts, which may be a barrier for teams using traditional Nix or other build systems.

Breaking Changes Risk

The CHANGELOG.md documents important, mostly breaking changes, indicating potential instability and migration efforts for users.

Complexity for Simple Use Cases

For basic Rust projects, the integration adds layers of Nix configuration that might outweigh the benefits of using Cargo alone.

Frequently Asked Questions

Quick Stats

Stars217
Forks26
Contributors0
Open Issues5
Last commit1 day ago
CreatedSince 2021

Tags

#flake-parts#flakes#integration#rust-lang#nix-flake#cargo#nix#package-management#flake#rust#reproducible-builds

Built With

N
Nix
f
flake-parts

Links & Resources

Website

Included in

Nix5.0k
Auto-fetched 10 hours ago

Related Projects

rust-overlayrust-overlay

Pure and reproducible nix overlay of binary distributed rust toolchains

Stars1,555
Forks87
Last commit1 day ago
cranecrane

A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.

Stars1,457
Forks140
Last commit4 days ago
fenixfenix

Rust toolchains and rust-analyzer nightly for Nix [maintainers=@figsoda, @eureka-cpu]

Stars1,116
Forks68
Last commit1 day ago
naersknaersk

Build Rust projects in Nix - no configuration, no code generation, no IFD, sandbox friendly.

Stars1,010
Forks101
Last commit2 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub