[WIP] PHP: Make the default package more sane #82794
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.
I made a chart of extensions in org-mode: http://ix.io/2evY
We had several insane defaults such as
The current PHP
The current closure size is:
And this contains things (among very others) like:
The new smaller PHP
Here we have a much smaller closure size:
I've still have to track down packages in nixpkgs that will break from this, some examples are probably nextcloud among others due to the missing database extensions.
The text was updated successfully, but these errors were encountered:
I have just completed the
The ones I'm not sure if they work during runtime are the following:
Recap: I had a very nice (remote) session with @etu hacking on this today.
We need to do some more thinking about how to make this a bit less obstrusive (it currently breaks every NixOS module shipping software requiring some sort of database access).
This could be solved by explicitly listing the required modules. However, the current approach istn't that nice. We could improve it by making the "default" php package configurable through system configuration, or by adding (some few) extensions.
There were also some cleanups (
This moves yet more extensions from the base build to phpPackages.ext. Some of the extensions are a bit quirky and need patching for this to work, most notably mysqlnd. Two new parameters are introduced for mkExtension - internalDeps and postPhpize. internalDeps is used to specify which other internal extensions the current extension depends on, in order to provide them at build time. postPhpize is for when patches and quirks need to be applied after running phpize.
A slight rewrite of buildEnv which: 1. Makes buildEnv recursively add itself to its output, so that it can be accessed from any php derivation. 2. Orders the extension text strings according to their internalDeps attribute - dependencies have to be put before dependants in the php.ini or they will fail to load due to missing symbols.
Opcache 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.
Also, document why the patch is needed.
This PR has grown, not because of bad reasons. And things have gone quite back and forth a few times and I don't like that. But I still want to do this. So I made #83514 where I've cherry-picked out the things we need and resolved all the conflicts and made the history cleaner and nicer.