anthropics

A Nix plugin that resolves Cargo workspaces natively and allows for crate level builds

10
2
100% credibility
Found May 23, 2026 at 13 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
Rust
AI Summary

This is a tool that helps you build Rust projects using Nix. Normally, building Rust with Nix requires generating large configuration files upfront. This plugin instead reads your project's dependency information directly from your Cargo.lock file and the package registry, resolving everything on the fly. It handles all your dependencies, optional features, platform-specific settings, and even git-based dependencies. The result is a faster, cleaner workflow where your Rust project builds reproducibly in Nix without the extra setup step.

How It Works

1
๐Ÿ”ง You have a Rust project

You've built something with Rust and Cargo, and now you want to build it reproducibly with Nix.

2
๐Ÿ“ฆ You hear about a better way

Instead of generating huge configuration files, this plugin reads your project's dependency information directly.

3
๐Ÿ”Œ You connect the plugin to Nix

You add the plugin to your Nix configuration so it can understand your Rust project.

4
โœจ Your project gets understood instantly

The plugin reads your Cargo.lock and the package registry to figure out every dependency, feature, and platform requirement.

5
๐Ÿ—๏ธ Everything builds automatically

Nix constructs each piece of your project with the right settings, linking everything together properly.

6
You can run tests or checks
๐Ÿงช
Run tests

Execute your test suite with all dependencies wired up correctly.

๐Ÿ”
Run clippy

Check your code with clippy, reusing compiled dependencies for speed.

๐ŸŽ‰ Your project is built and ready

Everything compiled successfully with all features resolved, exactly as your Cargo.toml intended.

Sign up to see the full architecture

5 more

Sign Up Free

Star Growth

See how this repo grew from 13 to 10 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is cargo-nix-plugin?

cargo-nix-plugin is a Nix plugin written in Rust that resolves Cargo workspaces natively, replacing the generated `Cargo.nix` file from crate2nix with a single `builtins.resolveCargoWorkspace` primop. Instead of running `cargo metadata` or generating massive lock files, it reads `Cargo.lock` and the sparse registry index directly at evaluation time. The resolver returns a Nix attrset compatible with `buildRustCrate`, handling dependencies, features, and platform-specific conditionals automatically. It also includes a clippy wrapper with caching and test execution support.

Why is it gaining traction?

The main hook is eliminating the `crate2nix generate` step entirely. With this plugin, you point at your workspace root and get a resolved crate graph without spawning a cargo subprocess or maintaining a 50K-100K line generated file. The resolver honors your existing `.cargo/config.toml` mirror configuration, so teams using Artifactory or other registries get transparent support without plugin-specific setup. The clippy caching is a practical win: dependencies compile once with normal rustc, and only workspace members re-check with clippy-driver, making lint runs on large workspaces dramatically faster.

Who should use this?

Rust developers on Nix/NixOS who are tired of the crate2nix workflow. If you maintain a polyglot monorepo where Rust packages need to integrate with Nixpkgs, this removes a generate step from your CI pipeline. Teams behind corporate firewalls that redirect cargo traffic to internal mirrors will appreciate the transparent registry support. Organizations with large Rust workspaces who run clippy in CI will benefit from the caching layer.

Verdict

This is a well-architected solution to a real pain point, backed by Anthropic, but the 10-star count and 1.0% credibility score signal early-stage software. The documentation is thorough and the feature set is complete, but you should expect to pin to a specific Nix version (2.34 for the default build) and test thoroughly before committing. Worth evaluating for new projects; treat existing crate2nix setups as "migrate when convenient" rather than urgent.

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.