buildRustPackage: use cargoHash from finalAttrs#472287
buildRustPackage: use cargoHash from finalAttrs#472287Prince213 wants to merge 1 commit intoNixOS:masterfrom
Conversation
|
This is a significant change as it shapes the |
|
It is not very productive to just say "there are things to consider." Of course there, but what are the alternatives? What are you preferred alternatives? Use your words rather than just saying "we need consensus." That is why I closed my last PR you commented on as I am very tired of Nixpkgs reviewers with unhelpful, unproductive comments. Please, inform us what the alternatives are. |
|
@RossSmyth You are right; I should provide alternatives to make the review constructive. Thank you for sharing the reason behind your closing PR and help me improve my reviewing. @Prince213 I apologize for blocking this PR with non-informative review. Here are some options I could think of:
|
|
Ideally we'd allow overriding both |
9918f7f to
2073159
Compare
So we are limiting the overrideAttrs interface to |
|
From my perspective, if the attr is passed to mkDerivation, then I'd default to reading it from In effect, the attr is already overridable. We're just asking whether other parts of the package should read the original value or the final value. |
I'm rather new to this field so please take my words with a grain of salt. My anticipation is that we do the following:
|
Please use
The problem is, if we reference |
I think that also works. But it will be under
I don't think I quite understand this. The definition we have here for
Please elaborate. |
|
The GitHub UI refuses to let me comment on some non-changing code sections, so I'll explain it here: Here is the initial definition of nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix Lines 104 to 130 in cdb722f The expresions after each It is totally fine to reference Since the choice (and switching) of candidates happens before the overriding (tricky, but it's how |
More discussion needed. Still approve of the concept.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
2073159 to
08205ae
Compare
There was a problem hiding this comment.
The diff looks good.
Could we add some test cases for the cargoHash overriding via overrideAttrs or referenced from finalAttrs in test/overriding.nix?
@NixOS/rust, should overriding/evaluation tests for buildRustPackage be added to the global test/overriding.nix, or should we add files under directory pkgs/build-support/rust/test?
|
IMO |
| else if args.cargoHash or null == null then | ||
| else if cargoHash == null then |
There was a problem hiding this comment.
For my own understanding: we didn't put cargoHash in the args unpacking because then functionArgs in extendMkDerivation would be affected, right? (If my understanding is correct, can someone clarify why this behavior was desirable at the time?)
| excludeDrvArgNames = [ | ||
| "depsExtraArgs" | ||
| "cargoUpdateHook" | ||
| "cargoLock" | ||
| "useFetchCargoVendor" | ||
| "RUSTFLAGS" | ||
| ]; |
There was a problem hiding this comment.
(Is there a reason we don't have e.g. cargoDepsName here, which we don't use directly in the arguments to constructDrv?)
There was a problem hiding this comment.
e.g. we do have depsExtraArgs here, which is used in the same way as cargoDepsName
Related to #415397.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.