Skip to content
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

PHP extensions as packages #82348

Merged
merged 3 commits into from Mar 14, 2020
Merged

PHP extensions as packages #82348

merged 3 commits into from Mar 14, 2020

Conversation

etu
Copy link
Contributor

@etu etu commented Mar 11, 2020

Motivation for this change

So this is based on some work I've done a long time ago and based on things that @gustavderdrache use to customize PHP in Nix.

It seems to work quite well on top of #79377 by @Ma27 :)

So the goal here is to build the different native extensions as separate derivations and then use them to compose a PHP package.

Example: Our default install of php doesn't have bz2 support.

Then I build a PHP using the following command:

nix-build --expr 'with import ./. {}; php74.buildEnv { exts = pp: with pp.exts; [ bz2 ]; }'

It builds a bit and I get a result symlink back, then when I run ./result/bin/php -m I can see bz2 in the list of modules.

I've got most extensions to work with two notable exceptions:

  • readline
  • gettext

But I don't think that's a blocker for merging this. This still would provide new extensions for people needing some of the "native" extensions that we don't have enabled or even flags for without the need of compiling them themselves.

The next step would be to provide a minimal PHP to compose on top of and to use this minimal one to build our default php setup.

I've gone through all extensions for php 7.2, 7.3 and 7.4 and made sure that I have either made a comment or a build for each and everyone of the extensions in these three minor versions of php.

Some of the ones are oracle and other weird databases that we may have pecl's for anyways, so those I've left as comments for now. But they should be easy to move if needed.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • [N/A] Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@etu etu requested review from Ma27 and aanderse March 11, 2020 22:12
@aanderse
Copy link
Member

@etu interesting stuff! When you get around to it I'm curious to see some stats on this for a fully loaded php vs a minimal.

@etu etu force-pushed the php-exts-as-packages branch 17 times, most recently from 7e1550a to f8e2e3e Compare March 14, 2020 15:22
@etu etu force-pushed the php-exts-as-packages branch 8 times, most recently from a5a1cb2 to 74d77e5 Compare March 14, 2020 17:20
@etu
Copy link
Contributor Author

etu commented Mar 14, 2020

@GrahamcOfBorg build php72Packages.exts php73Packages.exts php74Packages.exts

@etu etu marked this pull request as ready for review March 14, 2020 21:02
@etu
Copy link
Contributor Author

etu commented Mar 14, 2020

@aanderse @Ma27 I think we're getting closer to something that can be useful here and can be a good second step towards a more modular php setup in nixpkgs 🙂

@etu etu changed the title [wip] php extensions as packages PHP extensions as packages Mar 14, 2020
@adisbladis adisbladis merged commit 86a3326 into NixOS:master Mar 14, 2020
@etu etu deleted the php-exts-as-packages branch March 14, 2020 22:53
@etu etu mentioned this pull request Mar 15, 2020
10 tasks
@Ma27
Copy link
Member

Ma27 commented Mar 15, 2020

Bit late to the party, but just took a look and the code and it seems pretty nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants