update-source-version: update cargo hash if exists#392827
Closed
usertam wants to merge 1 commit intoNixOS:masterfrom
Closed
update-source-version: update cargo hash if exists#392827usertam wants to merge 1 commit intoNixOS:masterfrom
usertam wants to merge 1 commit intoNixOS:masterfrom
Conversation
Member
|
Thanks. Personally, I think I would prefer to keep the tool simple and with as little magic as possible. Alternative would be using update script combinators, see e.g. And if one is not allergic to heuristics-oriented tools, there is also nix-update-based |
Member
Author
|
Closing because too much magic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Let
gitUpdaterwork withrustPlatform.buildRustPackage; if$attr.cargoHashexists, update it.Current behavior
If we do something like
we would get error like
nixpkgs/pkgs/build-support/rust/hooks/cargo-setup-hook.sh
Lines 68 to 76 in 97dc21f
because
cargoHashwas never updated.Why now?
Since #349360 is here, rust packages no longer bundle their
flake.lockinside nixpkgs and now theircargoDepsonly depend oncargoHash, making updates much easier to automate.Difference from original hash replacing logic
I copied most of the hash updating behavior from the original script, but 1) default to replacing a fake sha256 hash as I see no one using sha512 in
cargoHash; and 2) skipped non-SRI-style hash handling sincecargoSha256is deprecated:nixpkgs/doc/languages-frameworks/rust.section.md
Lines 52 to 59 in fb65bbf
Testing
I only tested this against
firecrackerso far. Appreciate if other maintainers can test on their rust packages also. 🙏Open to suggestions, whether this is something needed or not; or if this should be implemented somewhere else and not polluting the
update-source-version.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.