-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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: add more passthru
attributes
#305256
build-support/php: add more passthru
attributes
#305256
Conversation
3cc27af
to
1bcc5fc
Compare
1bcc5fc
to
a8387fd
Compare
@@ -66,13 +66,18 @@ let | |||
inherit composer composer-local-repo-plugin; | |||
inherit (finalAttrs) patches pname src vendorHash version; | |||
|
|||
php = phpDrv; |
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.
Should not this already be the default thanks to using phpDrv.mkComposerRepository
?
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.
That's unclear to me yet, I was awaiting from you to confirm this. I'm a bit lost with those finalAttrs
and previousAttrs
. Can you help?
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.
Yeah, it should be the default. php
passes it to the php.packages
scope:
phpPackage = phpWithExtensions; |
which sets it as the php
attribute:
nixpkgs/pkgs/top-level/php-packages.nix
Line 181 in ee5ad61
php = phpPackage; |
and scope’s callPackage
will pass it to buildComposerPackage
:
nixpkgs/pkgs/top-level/php-packages.nix
Line 57 in ee5ad61
buildComposerProject = callPackage ../build-support/php/build-composer-project.nix { }; |
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.
OK for passing it to buildComposerProject = callPackage ../build-support/php/build-composer-project.nix { };
Thanks!
But when it comes to mkComposerRepository
, shouldn't it be inherited from buildComposerProject
?
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 it will be, since if you override php
in buildComposerProject
, the finalAttrs.php
will reflect that and you are taking mkComposerRepository
from its scope:
php-packages = (callPackage ../../../top-level/php-packages.nix { |
inherit (php-packages) extensions buildPecl mkComposerRepository buildComposerProject composerHooks mkExtension; |
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.
OK Good to know.
a8387fd
to
b67c751
Compare
b67c751
to
b07ab2e
Compare
composerLock = previousAttrs.composerLock or null; | ||
composerNoDev = previousAttrs.composerNoDev or true; | ||
composerNoPlugins = previousAttrs.composerNoPlugins or true; | ||
composerNoScripts = previousAttrs.composerNoScripts or true; | ||
composerStrictValidation = previousAttrs.composerStrictValidation or true; | ||
}; | ||
|
||
passthru = (previousAttrs.passthru or {}) // { |
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.
Actually, this will shadow php
externally:
nix-repl> (stdenv.mkDerivation {name = "foo"; php = 1; passthru.php = 2;}).php
2
nix-repl> (stdenv.mkDerivation (finalAttrs: {name = "foo"; php = 1; passthru.php = 2; c = finalAttrs.php;})).c
1
We should probably drop this and do stdenvNoCC.mkDerivation ({ inherit php; } // args)
to serve as an initial value and replacing phpDrv
with finalAttrs.php
instead.
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.
Maybe something like the following (untested):
--- a/pkgs/build-support/php/build-composer-project.nix
+++ b/pkgs/build-support/php/build-composer-project.nix
@@ -4,8 +4,10 @@ let
buildComposerProjectOverride = finalAttrs: previousAttrs:
let
- phpDrv = finalAttrs.php or php;
- composer = finalAttrs.composer or phpDrv.packages.composer;
+ initialArgs = {
+ inherit php;
+ };
+ composer = finalAttrs.composer or finalAttrs.php.composer;
composer-local-repo-plugin = callPackage ./pkgs/composer-local-repo-plugin.nix { };
in
{
@@ -18,12 +20,12 @@ let
nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [
composer
composer-local-repo-plugin
- phpDrv
- phpDrv.composerHooks.composerInstallHook
+ finalAttrs.php
+ finalAttrs.php.composerHooks.composerInstallHook
];
buildInputs = (previousAttrs.buildInputs or [ ]) ++ [
- phpDrv
+ finalAttrs.php
];
patches = previousAttrs.patches or [ ];
@@ -62,7 +64,7 @@ let
runHook postInstallCheck
'';
- composerRepository = phpDrv.mkComposerRepository {
+ composerRepository = finalAttrs.php.mkComposerRepository {
inherit composer composer-local-repo-plugin;
inherit (finalAttrs) patches pname src vendorHash version;
@@ -82,4 +84,4 @@ let
};
};
in
-args: (stdenvNoCC.mkDerivation args).overrideAttrs buildComposerProjectOverride
+args: (stdenvNoCC.mkDerivation (initialArgs // args)).overrideAttrs buildComposerProjectOverride
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.
initialArgs
is not in the scope in stdenvNoCC
, I moved it one level up... but it's not working anyway.
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.
Let me know what I can do to move on on this PR
2d42f64
to
7d620b9
Compare
7d620b9
to
d223bbc
Compare
No feedback in time and loosing interests into this. Closing. |
Related to #302136 (comment)
Description of changes
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.