Closed bradzacher closed 3 months ago
The issue looks like your version of thiserror
is incompatible with your version of rustc
. You'll need to change the pin on one of them.
That's weird because the rust version (1.75.0) is the same one I can use outside of nix and it builds fine.
Maybe I haven't correctly composed all the rust bits together and there's an old version from our base slipping in somewhere.
You may want to tweak buildRustCratesForPkgs
to echo some stats about your rustc version in the derivation so you can see exactly what's happening. You probably also need to find the derivation for thiserror-impl
and see what version of rustc is being used there.
I would appreciate such a change upstream to stick a cargo -V
and rustc -V
at the top of everything, but I dunno how the maintainers would feel about it.
Hmmm - showing the derivation it looks like it's depending on the correct rust version (1.75.0)
I can see both of these in the inputDrvs
:
/nix/store/yl3gvn5s94jq7b50x1z86synzgwm489p-cargo-1.75.0.drv
/nix/store/kznn438k9hic5b0xsrj3sfjragfhj288-rustc-wrapper-1.75.0.drv
And I can see these in the nativeBuildInputs
:
/nix/store/4j1xc3lq15g9y3vwdspi3g8ygl4xqajf-rustc-wrapper-1.75.0
/nix/store/dwb29sssx8m0kccpf886h5yqd9v9fjrj-cargo-1.75.0
I added cargo -V
and rustc -V
to build-rust-crate/build-crate.nix
locally and I can see both at 1.75.0:
cargo 1.75.0
rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)
This is consistent with each crate I can see being built too.
Googling does suggest that this error is likely something to do with the versioning though...
I'm going to close this as a problem with our infra.
I've been trying to get crate2nix working in my company's monorepo for a while now. We have a heinous nix setup with some super complicated overlays and multiple nix commits via pins that I don't endorse - but it is what it is.
I have it almost working now - I'm able to build almost all of the crates and dependencies. However the build is failing right now on this one error:
I've tried a few things, but I'm a bit out of my depth in terms of debugging this. I doubt you'll be able to directly fix things - but I was wondering if you had any ideas on what might be causing this to help me debug more.
Separately (maybe related?) I have found I needed the following patch to get things working so that I could pass the correct rust version into crate2nix[^1]: https://github.com/nix-community/crate2nix/compare/master...bradzacher:crate2nix:patch-1
[^1]: tl;dr here - our base commit is quite old, but it's hard to update at our scale. So we pull in newer nix commits to grab specific, targeted dependencies - like rust. But this does create a world where there's two potential versions of rust at once and so I needed to make sure I was passing the overridden rust version all the way through into crate2nix.