Replies: 2 comments 1 reply
-
maybe? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @jfly thanks for the detailed writeup! One thing I noticed is that the current version of I'll document this for anyone else who runs into it in the future so thanks for mentioning it! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm writing a simple flake using crane. I've diverged only very slightly from
nix flake init -t github:ipetkov/crane#quick-start-simple
, I've just addedv4l2-sys-mit
to my Cargo.toml (it's not particularly important, other than that it uses bindgen) andrustPlatform.bindgenHook
to my derivation'snativeBuildInputs
.I've noticed that I'm not benefiting from caching of
cargoArtifacts
as much as I'd like. I've put together a simple repro on https://github.com/jfly/crane-bindgen/tree/repro.I dug into this, and the problem ultimately comes down to:
-frandom-seed=...
value inNIX_CFLAGS_COMPILE
.rustPlatform.bindgenHook
then interpolates thatNIX_CFLAGS_COMPILE
flag intoBINDGEN_EXTRA_CLANG_ARGS
.BINDGEN_EXTRA_CLANG_ARGS
env var changes.See my commit message here jfly/crane-bindgen@4d12415 for an explanation of how I determined this.
I am able to work around this with a nasty hack to force
-frandom-seed
to the same value for both derivations (there might be a better way of accomplishing this in the nix/nixpkgs ecosystem, I didn't dig too far).Do you have any thoughts on a better fix for this? Perhaps crane's perspective is that this
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
is just something weird that bindgen does that isn't necessary in the nix ecosystem (where anything that would change thisBINDGEN_EXTRA_CLANG_ARGS
env var would trigger a rebuild from scratch anyways)?Beta Was this translation helpful? Give feedback.
All reactions