update-rust-derivation

Update Rust derivations in Nix with correct hashes and build verification.

7|Updated Aug 9, 2020
One-click install
npx skills add https://github.com/shinzui/dotfiles.nix --skill update-rust-derivation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: update-rust-derivation
Source: https://github.com/shinzui/dotfiles.nix/tree/main/claude/skills/update-rust-derivation
Command: npx skills add https://github.com/shinzui/dotfiles.nix --skill update-rust-derivation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Update a Rust derivation in Nix to a new version and ensure the corresponding hashes are updated for reproducible builds.

Core Features & Use Cases

  • Version bumping: update the version attribute in fetchFromGitHub and related fields.
  • Hash reconciliation: fetch new tarball hash, convert to SRI, and apply to the derivation.
  • Build verification: set cargoHash to a placeholder, run a build to reveal the correct cargoHash, then update it and re-build to verify success.

Quick Start

Use the update-rust-derivation skill to bump a Rust package version in a Nix derivation and refresh the hashes.

Frequently Asked Questions about update-rust-derivation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I update a Rust derivation in nixpkgs to a new version?

To update a Rust derivation, you bump the version attribute in fetchFromGitHub, prefetch the new source tarball, convert the hash to SRI format, and update the derivation fields for reproducible builds.

How do I calculate the correct cargoHash for a rustPlatform.buildRustPackage?

To calculate the correct cargoHash, set it to a placeholder value, run a build to reveal the expected hash from the build error, update the derivation with the correct hash, and re-build to verify success.

Why does my Nix Rust build fail with a hash mismatch after a version bump?

A Nix Rust build fails with a hash mismatch after a version bump because the source tarball hash and cargoHash must be updated to reflect the new dependencies and source code changes.

What is the process for converting a fetched tarball hash to SRI format in Nix?

Converting a fetched tarball hash to SRI format in Nix involves prefetching the source and transforming the resulting hash into the SRI representation required by the derivation for integrity verification.

When do I need to update cargoHash instead of just the source hash in a Nix expression?

You need to update cargoHash instead of just the source hash when maintaining Nix expressions for Rust packages where dependency changes occur, ensuring rustPlatform.buildRustPackage fetches the correct cargo vendor archive.