-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
PHP: Make the default package more sane [v3] #83896
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
Conversation
…ault Also, add opcache to default extensions since it significantly increases PHP's performance and is by default enabled on Debian based distributions. Not having it enabled by default results in a puzzling performance loss for anyone attempting to migrate from Debian/Ubuntu to NixOS who is unaware of this. Therefore, enable it by default. /talyz
@GrahamcOfBorg build php72 php73 php74 php72Packages.exts php73Packages.exts php74Packages.exts nixosTests.nextcloud nixosTests.php |
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 haven't been through all of this yet, but here are a few initial suggestions for wording in the documentation if anyone find them useful.
58b2478
to
fa50917
Compare
@GrahamcOfBorg build php72 php73 php74 php72Packages.exts php73Packages.exts php74Packages.exts nixosTests.nextcloud nixosTests.php |
My only remaining comment is that I wonder if it becomes confusing (or overly verbose) to have |
@aanderse Yes, that's also something we discussed, but decided that the scope of the PR was big enough as is. Definitely something to think about, though :) |
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.
Only read over the docs and skimmed over the code so far, haven't actually run anything yet.
I think we should typically go for the verbose options. Readability is important. Now, we already use |
This test checks that we evaluate PHP properly and that certain extensions are actually loaded.
So now we have only packages for human interaction in php.packages and only extensions in php.extensions. With this php.packages.exts have been merged into the same attribute set as all the other extensions to make it flat and nice. The nextcloud module have been updated to reflect this change as well as the documentation.
This provides a means to build a PHP package based on a list of extensions from another. For example, to generate a package with all default extensions enabled, except opcache, but with ImageMagick: php.withExtensions (e: (lib.filter (e: e != php.extensions.opcache) php.enabledExtensions) ++ [ e.imagick ])
dccccab
to
5ace72c
Compare
I've added an |
hi, i have a custom extension, that i need for my script. The extension build seems to work, but it's not available in my nix shell:
i have assumed that all enabled extensions would be passed to packages. When i run My previous version had an |
Hi @chpio! You're about right all the way there! Composer get's it's own environments PHP, and currently on master it doesn't use the overriden php. But this should be totally doable when we get #85026 together. With that PR you should be able to use This isn't something that have been easily doable before in Nix to do across all packages in a convenient way, so this will be a very exciting development :-) If you can it would be great if you can check out that PR and report back there if it works for you. @talyz and me will probably team up and try to get that one shaped up some day as well so we can get it in. If you want a faster workaround in the meanwhile you could make your own derivation for composer that just use your custom php since composer is only a phar anyways. Something like this can probably work for your case: let
myphp = pkgs.php74; # customize here
mycomposer = writeScriptBin "composer" ''
#!/bin/sh
${myphp} ${myphp.packages.composer}/libexec/composer/composer.phar \"$@\"
'';
in {} The only thing I know is missing from that composer is to inject unzip into the |
Motivation for this change
Our old PHP derivation was crazy big with a crazy amount of enabled extensions that also had a crazy amount of defaults that we pulled in, yet excluded some extensions that would have been nice to have by default.
This is a follow up on: #82348 to utilize #79377 more. And also a follow-up on all of the work done by me and @talyz in #82794 and #83514
But this grew a bit more, and was more complex than I imagined when I started this. But it became a collaboration project with @talyz to finish everything up.
We have also written the initial documentation for PHP in NixOS.
The current PHP
The current closure size is:
And this contains things (among others) like:
The new smaller PHP
Here we have a smaller closure size:
And we have a smaller base package:
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)