use crate2nix for some of our rust crates #3686
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current workflow for building rust crates is error-prone. It uses FOD, which can break in very subtle ways, and it's only visible when you either want to update the package, or some FOD got GC'ed from your store (or binary cache).
crate2nix allows a better workflow: given a source containing Cargo.toml and Cargo.lock, it can produce a
Cargo.nixfile (andcrate-hashes.json), which will create per-crate-granularity nix derivation, allowing faster rebuilds of partial updates, as well as less flakyness when it comes to FODs.cryptoboxrequired some hacks, ascabal(or our custom plumbing of calling cabal2Nix) expects a single output. I tried to work my way around this with emitting a pkg-config file, but couldn't get it to work, so now emit a single-output derivation (but the underlying build still uses crate2nix).libzauth-cdidn't build at all, it failed with [this errorI(https://stackoverflow.com/questions/73273886/why-do-i-get-prehashsignature-is-not-implemented-for-signature-error-when-usin). Instead of trying to push down certain feature flags, I tried bumping ourjwt-simplepin to the most recent commit on this branch (we should be having multiple versions of this in flight anyways), and it built. 🎉mls-test-clidoesn't work with crate2nix yet, due to a transitive build dependency being too crazy about#cfgusage in itsCargo.toml- I opened an upstream issue for that. Added a comment linking to the issue there.For
rusty_jwt_tools, I can't even create aCargo.nix. It seems like the workaround in wireapp/rusty-jwt-tools#54 (comment) is not sufficient for this mode of operation. We should really get a Cargo.lock file into the project root. Added a comment there, too.Checklist
changelog.d