-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildRustCrate: Allow version specific dependency renaming + parameter doc #84179
buildRustCrate: Allow version specific dependency renaming + parameter doc #84179
Conversation
Depends on NixOS/nixpkgs#84179
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor remarks. Overall this looks good.
I also see the need for version specific overrides for things like (native)buildInputs.
Currently you have to "switch" on the version or name attribute in the overrides if you need different native inputs for the same crate name.
We should probably consider what larger refactoring we can do additionally to ease such pains.
I know, heretic, but... I also know that this is not perfect but it is a good start, I think. It would be nice if this were part of the automatic "nixdoc" function reference. I'd like guidance if this should be part of the rust section or something else.
4824a32
to
bb660fe
Compare
Thank you for the review, @andir ! For buildInputs, the crateOverrides mechanism can be used. This PR is a bit special because it concerns the extern name with which a certain crate is used within a dependent crate. So maybe those separate concerns can be handled better but will still need to be handled differently. |
Depends on NixOS/nixpkgs#84179
This PR allows version specific crate renames:
I also documented all buildRustCrate parameters.
Motivation for this change
This roughly corresponds to the following snippet in Cargo.toml:
Including multiple versions of a crate is very popular during ecosystem transitions, e.g. from futures 0.1 to futures 0.3.
Corresponding issue in crate2nix: nix-community/crate2nix#83
Things done
sandbox
innix.conf
on non-NixOS linux)nix build -f . buildRustCrateTests
nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)