Skip to content

Vendor crates through fetchCargoVendor - #24

Merged
thedavidmeister merged 1 commit into
mainfrom
2026-09-14-fetch-cargo-vendor
Sep 14, 2026
Merged

thedavidmeister merged 1 commit into
mainfrom
2026-09-14-fetch-cargo-vendor

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Refs rainlanguage/rainix#377

What

cargoLock replaced by cargoDeps = fetchCargoVendor with the vendor hash. Same move rainix made for rainix-static and wasm-bindgen-cli.

Why

cargoLock fetches every crate from crates.io/api/v1/crates/<name>/<version>/download, which now answers 403 to any User-Agent starting with curl/, and nixpkgs fetchurl sends curl/<v> Nixpkgs/<v>. Every consumer that has to rebuild rain on a store miss (raindex git-clean on main, and every local devshell for rain.dia, rain.flare, rain.pyth, rain.merkle, rainlang, rainlang.deploy, rain.erc4626.words this weekend) fails with cannot download crate-<name>.tar.gz from any mirror. fetchCargoVendor downloads from the static.crates.io CDN, which has no User-Agent gate.

QA

  • Discriminating tests: n/a, a packaging change with no Rust source change; the proof is the build itself.
  • Mutations applied: n/a, no logic changed.
  • Oracle: from a shell, the API download URL returns 403 for curl/8.11.1 Nixpkgs/25.11 and 302 for Nixpkgs/25.11; nix build .#rain on this branch fetched the vendor set and produced the binary on a host where the cargoLock path 403s.
  • Category check: rainix#377 asks for rain-cli rebuilds to stop 403ing on crate fetches; covered for rain.cli. rainix itself already vendors through the CDN.

Local: nix build .#rain succeeds, vendor hash sha256-TrZzMmDnC07lhfjKdKfwNtrzbeRcxKewqTqmiZD2fic=. Consumers pick this up on their next flake.lock bump of the rain input.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V8ViHcKLVk2YoS2joH4HdN

Summary by CodeRabbit

  • Chores
    • Updated package dependency retrieval to use a more reliable source.
    • Added a fixed dependency vendor hash to improve reproducibility during builds.

cargoLock fetches every crate from crates.io/api, which now answers 403
to the curl User-Agent nix sends, so any store miss fails the build.
fetchCargoVendor pulls from the static.crates.io CDN.

Refs rainlanguage/rainix#377

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V8ViHcKLVk2YoS2joH4HdN
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e930e04b-6440-4d57-8c6b-db48ebbaa848

📥 Commits

Reviewing files that changed from the base of the PR and between 2481470 and 103ff2c.

📒 Files selected for processing (1)
  • flake.nix

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The Nix package now vendors Rust dependencies with fetchCargoVendor and a fixed hash instead of using cargoLock.

Changes

Rust dependency vendoring

Layer / File(s) Summary
Nix dependency source update
flake.nix
Replaces cargoLock settings with pkgs.rustPlatform.fetchCargoVendor, using the package source, name, and fixed hash. Comments document the CDN selection.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 103ff

This packaging-only change switches dependency retrieval to the static crates.io CDN with fixed-output hashing; no concrete build or runtime failure is established.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main packaging change: using fetchCargoVendor to vendor the Rust crates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-09-14-fetch-cargo-vendor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thedavidmeister
thedavidmeister merged commit 91d70ac into main Sep 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant