buildRustPackage: refactor to support finalAttrs pattern#354999
buildRustPackage: refactor to support finalAttrs pattern#354999TomaSajt wants to merge 3 commits intoNixOS:masterfrom
Conversation
12b63e7 to
bba2752
Compare
a9bea81 to
639e245
Compare
cfe8797 to
7552eb6
Compare
4b14c19 to
dd7fb2e
Compare
16d8715 to
3b3a29b
Compare
7241897 to
3bc378a
Compare
3bc378a to
94fe111
Compare
I'm not sure why you believe this. PRs to Check the closed PRs for many, many more examples: https://github.com/NixOS/nixpkgs/issues?q=label%3A%2210.rebuild-linux%3A+5001%2B%22+is%3Aclosed The
We should assume that it's on a case-by-case basis, and that 5001+ rebuilds is definitely not too many. |
94fe111 to
c306e6f
Compare
|
I was not planning on splitting this up. But also, I was not planning on pointing this at master, since it's unnecessary load on the builders. And also, many people would not be able to use the cache for a time on master because of this. Merging into master is understandable in case of important security fixes, which this is not. |
|
Also, this is a duplicate of #194475, which has at least been reviewed to some extent. |
Yes, see the first line of this PR. This PR is slightly better in the sense that it allows overriding the There were a few things I disliked about that PR: First, is the way it first passes and "invalid" attrset (still has Second, (this is mostly just an issue I had with the current builder), it still had the many "unnecesary" defaults. These are present to be able to pass something to the fetchers. I used the custom |
c306e6f to
892378f
Compare
892378f to
cab083b
Compare
Oops, sorry, my bad 🤦♀️ |
Quoting the contributing guide:
And while the definition of mass rebuilds is not "formally defined", the guide does give us a marker for it by saying:
So while yes, this is on a case-by case (such as in the Regarding this patch specifically, it is causing rebuilds of every Rust package and it's dependents -- totaling up to over 31k packages -- for something that doesn't actually change the behavior of binaries. I think Toma was correct in targeting staging here |
Context: The rules are not applied strictly, to allow security sensitive prs go to master directly. The linked pr was fixing High Severity security issues (that allowed RCE). I assume that there everyone would agree that it should not merged to staging to receive the update in 2-3 weeks. non security sensitive mass rebuilds in general should target staging, in the past such prs also have been reverted in the past (when merged directly to master) to not let hydra eat full rebuilds |
|
I guess this PR can be closed now? |
|
I'll close it for now. |
I'll rebase onto staging once this PR is reviewed.
Supersedes #194475
Supersedes #288430
Supersedes #340798
Related:
finalAttrssupport #331398 (not perfect, IMO).overridePythonAttrsto also worry about...)This PR refactors the
buildRustPackagewrapper aroundmkDerivationto support thefinalAttrspattern better.A non-goal was having 0 rebuilds.
The rebuilds are because of more attrs actually being passed to
mkDerivation, improving overridability without having to add an extra.overrideRustAttrsutility, which would complicate things a lot.Other than just being able to do something like
you'll also be able to override derivations much easier:
cargoLockis something that can only be insidepassthru, since it can't be converted to a string.Because of this, the input
cargoLockis moved topassthru.cargoLock.This means overriding is a bit painful, but at least it's possible.
This means that to override a package that uses
cargoLockto usecargoHash, you will need to setpassthru.cargoLockto null:You may also just override
cargoDepsdirectly, like you would have done before this PRNote:
I dislike the following function pattern:
{ name ? "default", ... }@attrs: args // { inherit name; } // modifiedAttrsI used the following instead:
attrs: defaultValues // lib.removeAttrs attrs namesToDelete // modifiedAttrsThis means that we lose the
functionArgsinformation, but I think the current version is more readable.Also
functionArgsonly makes sense if the input tobuildRustPackageis not a function-recursive attrset.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.