Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

use crate2nix for some of our rust crates #3686

Merged
merged 11 commits into from
Nov 1, 2023
Merged

use crate2nix for some of our rust crates #3686

merged 11 commits into from
Nov 1, 2023

Conversation

flokli
Copy link
Contributor

@flokli flokli commented Nov 1, 2023

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.nix file (and crate-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.

cryptobox required some hacks, as cabal (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-c didn'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 our jwt-simple pin to the most recent commit on this branch (we should be having multiple versions of this in flight anyways), and it built. 馃帀

mls-test-cli doesn't work with crate2nix yet, due to a transitive build dependency being too crazy about #cfg usage in its Cargo.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 a Cargo.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

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

These function args are unused.
Still using that wireapp/rust-jwt-simple repository, but at least the
latest version of the code, not a commit from Feb 10.
This needs crate2nix 0.11.0 (from a more recent nixpkgs checkout), but
only during Cargo.nix recreation.

Let's hope it's there the next time we update this file.
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Nov 1, 2023
Copy link
Contributor

@MangoIV MangoIV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me :)

nix/pkgs/cryptobox/README.md Show resolved Hide resolved
@flokli flokli merged commit 3ec60b9 into develop Nov 1, 2023
9 checks passed
@flokli flokli deleted the crate2nix branch November 1, 2023 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants