nix-community / crate2nix

rebuild only changed crates in CI with crate2nix and nix
https://nix-community.github.io/crate2nix/
Apache License 2.0
335 stars 82 forks source link

Some sort of support for .cargo/config.toml ? #338

Open Fuuzetsu opened 3 months ago

Fuuzetsu commented 3 months ago

We have something like this in our .cargo/config.toml

[target.'cfg(target_arch="x86_64")']
rustflags = "-Ctarget-feature=+fma,+avx2"

[target.'cfg(target_arch="aarch64")']
rustflags = "-Ctarget-cpu=native"

After crate2nix, on x86_64 there's no mention of those explicit target features. We're currently doing a hack where we manually override all of the crates out of Cargo.nix to re-add these but that's quite manual and generally annoying. It'd be very nice if some basic features were supported. Or at least we should have a closed ticket that's explicit about not supporting this or something.

Ten0 commented 2 months ago

https://github.com/nix-community/crate2nix/issues/345#issuecomment-2088692592 may be a generic workaround that avoids having to manually operate on each crate, however it is a bit hacky in that it uses cargoNix.internal to identify the list of crates, then specify the flags for each of them individually.