# Is it possible to override cargoSha256 in buildRustPackage?

**URL:** https://discourse.nixos.org/t/is-it-possible-to-override-cargosha256-in-buildrustpackage/4393
**Category:** Help
**Created:** [October 16, 2019, 1:07pm UTC](https://discourse.nixos.org/t/is-it-possible-to-override-cargosha256-in-buildrustpackage/4393 "2019-10-16T13:07:34Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![amjoseph](https://discourse.nixos.org/user_avatar/discourse.nixos.org/amjoseph/32/28378_2.png) [@amjoseph](https://discourse.nixos.org/u/amjoseph)
#### Post date: [May 8, 2022, 4:21am UTC](https://discourse.nixos.org/t/is-it-possible-to-override-cargosha256-in-buildrustpackage/4393/7 "2022-05-08T04:21:38Z")

</div>

Hi folks, just to clarify: it appears that while you can override the _outputs_ of a `buildRustPackage` derivation, it isn’t possible to override the _inputs_ (i.e. dependencies). Please let me know if I’m wrong about this (and feel free to revert my edits to the [wiki page](https://nixos.wiki/wiki/Rust) which note this).

I [struggled quite a bit with this](https://github.com/a-m-joseph/nixpkgs/commit/232887fef66d50649714b3b45618ce7497ea6da0) before giving up, going so far as to reify the `Cargo.lock` using `fromTOML`, patching it, then writing it back out with `remarshal`, and using `cargo-edit` to patch the dependencies’ `Cargo.toml` files. My use case involves an A-\>B-\>C dependency where I need to replace “C”, so the `Cargo.toml` in “B” needs to be rewritten.

Specifically, I’m trying to swap out the [ring](https://github.com/briansmith/ring) cryptography library with [IBM’s fork](https://github.com/IBM/ring/tree/ppc-0.16.20) which has support for powerpc64le ([PR to merge upstream](https://github.com/briansmith/ring/pull/1057)). I picked `tiny` as an example case but pretty much anything written in Rust that uses cryptography or HTTPs relies on ring. **The goal here was _not_ to have to run `cargo update` for every single rust package that uses ring (or that _can_ use it in place of openssl).** This is a large and rapidly growing number of packages. It ought to be possible to calculate the new checksum for ring once, and then patch that value in using non-network-accessing operations, inside of nix derivations.

I ended up in never-ending fights with cargo, which really wants to do things its way. The closest I ever got always managed to end with something like

```auto
error: the lock file /build/source/Cargo.lock needs to be updated but --frozen was passed to prevent this

```

If there is a way around this please do let me know. Until then my working assumption is that `cargo` simply doesn’t support the kinds of magic that nix has gotten me addicted to using. The only way forward here appears to be to skip cargo and have nix drive the build process with [crate2nix](https://github.com/kolloch/crate2nix).

---

_[View the full topic](https://discourse.nixos.org/t/is-it-possible-to-override-cargosha256-in-buildrustpackage/4393)._
