-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
build-support/php: support lib.extendMkDerivation
#385830
Conversation
678e601
to
a2e2ee9
Compare
…poserProject2` Inspired from NixOS#382550 Context: NixOS#234651
…erVendor` Inspired from NixOS#382550 Context: NixOS#234651
a2e2ee9
to
4cdddfa
Compare
@ofborg build phpunit phpPackages.psalm |
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.
Passes my eyeball test
Going through the diff, this PR seems to change the way |
@JohnRTitor For non-leaf packages, and especially far reaching changes like this, there should be a longer review period. Probably at least a week, since many contributors only have time for review e.g. during weekends. |
If this interface change is intended, there should be a release note entry under the "Backward incompatibility" sub-section. If not, it is easy to fix -- just add back the |
Thanks, I will keep this in mind, though I thought this was a straightforward change. |
inherit (finalAttrs) | ||
patches | ||
pname | ||
src | ||
vendorHash |
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.
I think this is intended? @drupol
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.
Yes this was intended indeed. Is there any issue?
For some unknown reasons, I received all the Github notifications from this thread now. Let me know if there are adjustments to do and I'll gladly do it. So far, from the tests I made, I haven't encountered any issue. |
Here's a minimal, Nix REPL-based reproducer that shows the changes of overriding behaviour. After this PR: nixpkgs_losslesscut on HEAD (359c7c9) [$]
❯ nix repl
Nix 2.24.10
Type :? for help.
nix-repl> lib = import ./lib
nix-repl> pkgs = import ./. { config = { allowAliases = false; checkMeta = true; }; }
nix-repl> pkgs.phpPackages.php-parallel-lint
«derivation /nix/store/ydvfkm3d61pmnwnnbm7xz44j73l19vwx-php-parallel-lint-1.4.0.drv»
nix-repl> pkgs.phpPackages.php-parallel-lint.vendorHash
"sha256-ySdLlqlGKZ6LgmAOBMkBNoCAqWrgMwE/Cj6ZEPEsCko="
nix-repl> pkgs.phpPackages.php-parallel-lint.composerVendor
«derivation /nix/store/zpshq5qc1nl6v17dhpbb27n844z32pli-php-parallel-lint-composer-vendor-1.4.0.drv»
nix-repl> pkgs.phpPackages.php-parallel-lint.composerVendor.outputHash
"sha256-ySdLlqlGKZ6LgmAOBMkBNoCAqWrgMwE/Cj6ZEPEsCko="
nix-repl> (pkgs.phpPackages.php-parallel-lint.overrideAttrs { vendorHash = lib.fakeHash; })
«derivation /nix/store/61zgmy4zd55g65c880pv7znfm5p44mxc-php-parallel-lint-1.4.0.drv»
nix-repl> (pkgs.phpPackages.php-parallel-lint.overrideAttrs { vendorHash = lib.fakeHash; }).vendorHash
"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
nix-repl> (pkgs.phpPackages.php-parallel-lint.overrideAttrs { vendorHas
h = lib.fakeHash; }).composerVendor
«derivation /nix/store/zpshq5qc1nl6v17dhpbb27n844z32pli-php-parallel-lint-composer-vendor-1.4.0.drv»
nix-repl> (pkgs.phpPackages.php-parallel-lint.overrideAttrs { vendorHas
h = lib.fakeHash; }).composerVendor.outputHash
"sha256-ySdLlqlGKZ6LgmAOBMkBNoCAqWrgMwE/Cj6ZEPEsCko="
Before this PR: nixpkgs_losslesscut on HEAD (d857a85) [$]
❯ nix repl
Nix 2.24.10
Type :? for help.
nix-repl> lib = import ./lib
nix-repl> pkgs = import ./. { config = { allowAliases = false; checkMeta = true; }; }
nix-repl> pkgs.phpPackages.php-parallel-lint
«derivation /nix/store/xdild3457dac1937f20lrzhnqq0546mg-php-parallel-lint-1.4.0.drv»
nix-repl> pkgs.phpPackages.php-parallel-lint.vendorHash
"sha256-ySdLlqlGKZ6LgmAOBMkBNoCAqWrgMwE/Cj6ZEPEsCko="
nix-repl> pkgs.phpPackages.php-parallel-lint.composerVendor
«derivation /nix/store/49k377wlvckalhqg71mba1ygmwd0k8n2-php-parallel-lint-composer-repository-1.4.0.drv»
nix-repl> pkgs.phpPackages.php-parallel-lint.composerVendor.outputHash
"sha256-ySdLlqlGKZ6LgmAOBMkBNoCAqWrgMwE/Cj6ZEPEsCko="
nix-repl> (pkgs.phpPackages.php-parallel-lint.overrideAttrs { vendorHash = lib.fakeHash; })
«derivation /nix/store/7lg86qm6m9q97qdzls0hqn8sxmvvl08x-php-parallel-lint-1.4.0.drv»
nix-repl> (pkgs.phpPackages.php-parallel-lint.overrideAttrs { vendorHash = lib.fakeHash; }).vendorHash
"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
nix-repl> (pkgs.phpPackages.php-parallel-lint.overrideAttrs { vendorHash = lib.fakeHash; }).composerVendor
«derivation /nix/store/xn7pxq9djyrc8dcpqlg4kdm5i7fmskvx-php-parallel-lint-composer-repository-1.4.0.drv»
nix-repl> (pkgs.phpPackages.php-parallel-lint.overrideAttrs { vendorHash = lib.fakeHash; }).composerVendor.outputHash
"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
nixpkgs_losslesscut on HEAD (d857a85) [$] took 48s
❯ |
OK I see. Then, with these changes introduced in this PR, there's no way to override the |
phpPackages.php-parallel-lint.overrideAttrs (
previousAttrs:
{
composerVendor = previousAttrs.composerVendor.overrideAttrs (
previousAttrs: {
vendorHash = "new vendorHash";
});
}) and phpPackages.php-parallel-lint.overrideAttrs (
previousAttrs:
{
composerVendor = previousAttrs.composerVendor.overrideAttrs (
previousAttrs: {
outputHash = "new vendorHash";
});
}) still work. The core issue is, which way of overriding is officially supported?
And it/its change require documentation. |
OK. I'll rework all of this tonight. |
Do we want a revert in the meantime since this breaks existing behaviour? |
I don't think it is necessary, tonight there will be a fix. |
The PHP builders were supporting the
finalAttrs
pattern from the beginning (thanks @jtojnar for this!). This PR update the builders usinglib.extendMkDerivation
.Inspired from #382550
Context: #234651
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-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.