Merge pull request #83896 from etu/slim-down-default-php-v3
PHP: Make the default package more sane [v3]
This commit is contained in:
commit
3b6539896b
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -178,6 +178,7 @@
|
|||||||
/nixos/tests/prometheus-exporters.nix @WilliButz
|
/nixos/tests/prometheus-exporters.nix @WilliButz
|
||||||
|
|
||||||
# PHP
|
# PHP
|
||||||
|
/doc/languages-frameworks/php.section.md @etu
|
||||||
/pkgs/development/interpreters/php @etu
|
/pkgs/development/interpreters/php @etu
|
||||||
/pkgs/top-level/php-packages.nix @etu
|
/pkgs/top-level/php-packages.nix @etu
|
||||||
/pkgs/build-support/build-pecl.nix @etu
|
/pkgs/build-support/build-pecl.nix @etu
|
||||||
|
112
doc/languages-frameworks/php.section.md
Normal file
112
doc/languages-frameworks/php.section.md
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# PHP
|
||||||
|
|
||||||
|
## User Guide
|
||||||
|
|
||||||
|
### Using PHP
|
||||||
|
|
||||||
|
#### Overview
|
||||||
|
|
||||||
|
Several versions of PHP are available on Nix, each of which having a
|
||||||
|
wide variety of extensions and libraries available.
|
||||||
|
|
||||||
|
The attribute `php` refers to the version of PHP considered most
|
||||||
|
stable and thoroughly tested in nixpkgs for any given release of
|
||||||
|
NixOS. Note that while this version of PHP may not be the latest major
|
||||||
|
release from upstream, any version of PHP supported in nixpkgs may be
|
||||||
|
utilized by specifying the desired attribute by version, such as
|
||||||
|
`php74`.
|
||||||
|
|
||||||
|
Only versions of PHP that are supported by upstream for the entirety
|
||||||
|
of a given NixOS release will be included in that release of
|
||||||
|
NixOS. See [PHP Supported
|
||||||
|
Versions](https://www.php.net/supported-versions.php).
|
||||||
|
|
||||||
|
Interactive tools built on PHP are put in `php.packages`; composer is
|
||||||
|
for example available at `php.packages.composer`.
|
||||||
|
|
||||||
|
Most extensions that come with PHP, as well as some popular
|
||||||
|
third-party ones, are available in `php.extensions`; for example, the
|
||||||
|
opcache extension shipped with PHP is available at
|
||||||
|
`php.extensions.opcache` and the third-party ImageMagick extension at
|
||||||
|
`php.extensions.imagick`.
|
||||||
|
|
||||||
|
The different versions of PHP that nixpkgs provides is located under
|
||||||
|
attributes named based on major and minor version number; e.g.,
|
||||||
|
`php74` is PHP 7.4 with commonly used extensions installed,
|
||||||
|
`php74base` is the same PHP runtime without extensions.
|
||||||
|
|
||||||
|
#### Installing PHP with packages
|
||||||
|
|
||||||
|
A PHP package with specific extensions enabled can be built using
|
||||||
|
`php.withExtensions`. This is a function which accepts an anonymous
|
||||||
|
function as its only argument; the function should take one argument,
|
||||||
|
the set of all extensions, and return a list of wanted extensions. For
|
||||||
|
example, a PHP package with the opcache and ImageMagick extensions
|
||||||
|
enabled:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
php.withExtensions (e: with e; [ imagick opcache ])
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that this will give you a package with _only_ opcache and
|
||||||
|
ImageMagick, none of the other extensions which are enabled by default
|
||||||
|
in the `php` package will be available.
|
||||||
|
|
||||||
|
To enable building on a previous PHP package, the currently enabled
|
||||||
|
extensions are made available in its `enabledExtensions`
|
||||||
|
attribute. For example, to generate a package with all default
|
||||||
|
extensions enabled, except opcache, but with ImageMagick:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
php.withExtensions (e:
|
||||||
|
(lib.filter (e: e != php.extensions.opcache) php.enabledExtensions)
|
||||||
|
++ [ e.imagick ])
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want a PHP build with extra configuration in the `php.ini`
|
||||||
|
file, you can use `php.buildEnv`. This function takes two named and
|
||||||
|
optional parameters: `extensions` and `extraConfig`. `extensions`
|
||||||
|
takes an extension specification equivalent to that of
|
||||||
|
`php.withExtensions`, `extraConfig` a string of additional `php.ini`
|
||||||
|
configuration parameters. For example, a PHP package with the opcache
|
||||||
|
and ImageMagick extensions enabled, and `memory_limit` set to `256M`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
php.buildEnv {
|
||||||
|
extensions = e: with e; [ imagick opcache ];
|
||||||
|
extraConfig = "memory_limit=256M";
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Example setup for `phpfpm`
|
||||||
|
|
||||||
|
You can use the previous examples in a `phpfpm` pool called `foo` as
|
||||||
|
follows:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let
|
||||||
|
myPhp = php.withExtensions (e: with e; [ imagick opcache ]);
|
||||||
|
in {
|
||||||
|
services.phpfpm.pools."foo".phpPackage = myPhp;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let
|
||||||
|
myPhp = php.buildEnv {
|
||||||
|
extensions = e: with e; [ imagick opcache ];
|
||||||
|
extraConfig = "memory_limit=256M";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
services.phpfpm.pools."foo".phpPackage = myPhp;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Example usage with `nix-shell`
|
||||||
|
|
||||||
|
This brings up a temporary environment that contains a PHP interpreter
|
||||||
|
with the extensions `imagick` and `opcache` enabled.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
nix-shell -p 'php.buildEnv { extensions = e: with e; [ imagick opcache ]; }'
|
||||||
|
```
|
@ -128,6 +128,73 @@
|
|||||||
documentation for instructions.
|
documentation for instructions.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Since this release there's an easy way to customize your PHP install to get a much smaller
|
||||||
|
base PHP with only wanted extensions enabled. See the following snippet installing a smaller PHP
|
||||||
|
with the extensions <literal>imagick</literal>, <literal>opcache</literal> and
|
||||||
|
<literal>pdo_mysql</literal> loaded:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
environment.systemPackages = [
|
||||||
|
(pkgs.php.buildEnv { extensions = pp: with pp; [
|
||||||
|
imagick
|
||||||
|
opcache
|
||||||
|
pdo_mysql
|
||||||
|
]; })
|
||||||
|
];</programlisting>
|
||||||
|
|
||||||
|
The default <literal>php</literal> attribute hasn't lost any extensions -
|
||||||
|
the <literal>opcache</literal> extension was added there.
|
||||||
|
|
||||||
|
All upstream PHP extensions are available under <package><![CDATA[php.extensions.<name?>]]></package>.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The updated <literal>php</literal> attribute is now easily customizable to your liking
|
||||||
|
by using extensions instead of writing config files or changing configure flags.
|
||||||
|
|
||||||
|
Therefore we have removed the following configure flags:
|
||||||
|
|
||||||
|
<itemizedlist>
|
||||||
|
<title>PHP <literal>config</literal> flags that we don't read anymore:</title>
|
||||||
|
<listitem><para><literal>config.php.argon2</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.bcmath</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.bz2</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.calendar</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.curl</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.exif</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.ftp</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.gd</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.gettext</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.gmp</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.imap</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.intl</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.ldap</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.libxml2</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.libzip</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.mbstring</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.mysqli</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.mysqlnd</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.openssl</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.pcntl</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.pdo_mysql</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.pdo_odbc</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.pdo_pgsql</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.phpdbg</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.postgresql</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.readline</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.soap</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.sockets</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.sodium</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.sqlite</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.tidy</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.xmlrpc</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.xsl</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.zip</literal></para></listitem>
|
||||||
|
<listitem><para><literal>config.php.zlib</literal></para></listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -6,27 +6,28 @@ let
|
|||||||
cfg = config.services.nextcloud;
|
cfg = config.services.nextcloud;
|
||||||
fpm = config.services.phpfpm.pools.nextcloud;
|
fpm = config.services.phpfpm.pools.nextcloud;
|
||||||
|
|
||||||
phpPackage = pkgs.php73;
|
phpPackage =
|
||||||
phpPackages = pkgs.php73Packages;
|
let
|
||||||
|
base = pkgs.php74;
|
||||||
|
in
|
||||||
|
base.buildEnv {
|
||||||
|
extensions = e: with e;
|
||||||
|
base.enabledExtensions ++ [
|
||||||
|
apcu redis memcached imagick
|
||||||
|
];
|
||||||
|
extraConfig = phpOptionsStr;
|
||||||
|
};
|
||||||
|
|
||||||
toKeyValue = generators.toKeyValue {
|
toKeyValue = generators.toKeyValue {
|
||||||
mkKeyValue = generators.mkKeyValueDefault {} " = ";
|
mkKeyValue = generators.mkKeyValueDefault {} " = ";
|
||||||
};
|
};
|
||||||
|
|
||||||
phpOptionsExtensions = ''
|
|
||||||
${optionalString cfg.caching.apcu "extension=${phpPackages.apcu}/lib/php/extensions/apcu.so"}
|
|
||||||
${optionalString cfg.caching.redis "extension=${phpPackages.redis}/lib/php/extensions/redis.so"}
|
|
||||||
${optionalString cfg.caching.memcached "extension=${phpPackages.memcached}/lib/php/extensions/memcached.so"}
|
|
||||||
extension=${phpPackages.imagick}/lib/php/extensions/imagick.so
|
|
||||||
zend_extension = opcache.so
|
|
||||||
opcache.enable = 1
|
|
||||||
'';
|
|
||||||
phpOptions = {
|
phpOptions = {
|
||||||
upload_max_filesize = cfg.maxUploadSize;
|
upload_max_filesize = cfg.maxUploadSize;
|
||||||
post_max_size = cfg.maxUploadSize;
|
post_max_size = cfg.maxUploadSize;
|
||||||
memory_limit = cfg.maxUploadSize;
|
memory_limit = cfg.maxUploadSize;
|
||||||
} // cfg.phpOptions;
|
} // cfg.phpOptions;
|
||||||
phpOptionsStr = phpOptionsExtensions + (toKeyValue phpOptions);
|
phpOptionsStr = toKeyValue phpOptions;
|
||||||
|
|
||||||
occ = pkgs.writeScriptBin "nextcloud-occ" ''
|
occ = pkgs.writeScriptBin "nextcloud-occ" ''
|
||||||
#! ${pkgs.stdenv.shell}
|
#! ${pkgs.stdenv.shell}
|
||||||
@ -38,7 +39,6 @@ let
|
|||||||
export NEXTCLOUD_CONFIG_DIR="${cfg.home}/config"
|
export NEXTCLOUD_CONFIG_DIR="${cfg.home}/config"
|
||||||
$sudo \
|
$sudo \
|
||||||
${phpPackage}/bin/php \
|
${phpPackage}/bin/php \
|
||||||
-c ${pkgs.writeText "php.ini" phpOptionsStr}\
|
|
||||||
occ $*
|
occ $*
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ in rec {
|
|||||||
"nixos.tests.nfs4.simple.x86_64-linux"
|
"nixos.tests.nfs4.simple.x86_64-linux"
|
||||||
"nixos.tests.openssh.x86_64-linux"
|
"nixos.tests.openssh.x86_64-linux"
|
||||||
"nixos.tests.pantheon.x86_64-linux"
|
"nixos.tests.pantheon.x86_64-linux"
|
||||||
"nixos.tests.php-pcre.x86_64-linux"
|
"nixos.tests.php.x86_64-linux"
|
||||||
"nixos.tests.plasma5.x86_64-linux"
|
"nixos.tests.plasma5.x86_64-linux"
|
||||||
"nixos.tests.predictable-interface-names.predictableNetworkd.x86_64-linux"
|
"nixos.tests.predictable-interface-names.predictableNetworkd.x86_64-linux"
|
||||||
"nixos.tests.predictable-interface-names.predictable.x86_64-linux"
|
"nixos.tests.predictable-interface-names.predictable.x86_64-linux"
|
||||||
|
@ -40,7 +40,7 @@ in rec {
|
|||||||
nat
|
nat
|
||||||
nfs3
|
nfs3
|
||||||
openssh
|
openssh
|
||||||
php-pcre
|
php
|
||||||
predictable-interface-names
|
predictable-interface-names
|
||||||
proxy
|
proxy
|
||||||
simple;
|
simple;
|
||||||
@ -108,7 +108,7 @@ in rec {
|
|||||||
"nixos.tests.nat.standalone.x86_64-linux"
|
"nixos.tests.nat.standalone.x86_64-linux"
|
||||||
"nixos.tests.nfs3.simple.x86_64-linux"
|
"nixos.tests.nfs3.simple.x86_64-linux"
|
||||||
"nixos.tests.openssh.x86_64-linux"
|
"nixos.tests.openssh.x86_64-linux"
|
||||||
"nixos.tests.php-pcre.x86_64-linux"
|
"nixos.tests.php.x86_64-linux"
|
||||||
"nixos.tests.predictable-interface-names.predictable.x86_64-linux"
|
"nixos.tests.predictable-interface-names.predictable.x86_64-linux"
|
||||||
"nixos.tests.predictable-interface-names.predictableNetworkd.x86_64-linux"
|
"nixos.tests.predictable-interface-names.predictableNetworkd.x86_64-linux"
|
||||||
"nixos.tests.predictable-interface-names.unpredictable.x86_64-linux"
|
"nixos.tests.predictable-interface-names.unpredictable.x86_64-linux"
|
||||||
|
@ -241,7 +241,7 @@ in
|
|||||||
peerflix = handleTest ./peerflix.nix {};
|
peerflix = handleTest ./peerflix.nix {};
|
||||||
pgjwt = handleTest ./pgjwt.nix {};
|
pgjwt = handleTest ./pgjwt.nix {};
|
||||||
pgmanage = handleTest ./pgmanage.nix {};
|
pgmanage = handleTest ./pgmanage.nix {};
|
||||||
php-pcre = handleTest ./php-pcre.nix {};
|
php = handleTest ./php {};
|
||||||
plasma5 = handleTest ./plasma5.nix {};
|
plasma5 = handleTest ./plasma5.nix {};
|
||||||
plotinus = handleTest ./plotinus.nix {};
|
plotinus = handleTest ./plotinus.nix {};
|
||||||
postgis = handleTest ./postgis.nix {};
|
postgis = handleTest ./postgis.nix {};
|
||||||
|
7
nixos/tests/php/default.nix
Normal file
7
nixos/tests/php/default.nix
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{ system ? builtins.currentSystem,
|
||||||
|
config ? {},
|
||||||
|
pkgs ? import ../../.. { inherit system config; }
|
||||||
|
}: {
|
||||||
|
fpm = import ./fpm.nix { inherit system pkgs; };
|
||||||
|
pcre = import ./pcre.nix { inherit system pkgs; };
|
||||||
|
}
|
55
nixos/tests/php/fpm.nix
Normal file
55
nixos/tests/php/fpm.nix
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import ../make-test-python.nix ({pkgs, ...}: {
|
||||||
|
name = "php-fpm-nginx-test";
|
||||||
|
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ etu ];
|
||||||
|
|
||||||
|
machine = { config, lib, pkgs, ... }: {
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
virtualHosts."phpfpm" = let
|
||||||
|
testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
|
||||||
|
in {
|
||||||
|
root = "${testdir}/web";
|
||||||
|
locations."~ \.php$".extraConfig = ''
|
||||||
|
fastcgi_pass unix:${config.services.phpfpm.pools.foobar.socket};
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||||
|
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||||
|
'';
|
||||||
|
locations."/" = {
|
||||||
|
tryFiles = "$uri $uri/ index.php";
|
||||||
|
index = "index.php index.html index.htm";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.phpfpm.pools."foobar" = {
|
||||||
|
user = "nginx";
|
||||||
|
settings = {
|
||||||
|
"listen.group" = "nginx";
|
||||||
|
"listen.mode" = "0600";
|
||||||
|
"listen.owner" = "nginx";
|
||||||
|
"pm" = "dynamic";
|
||||||
|
"pm.max_children" = 5;
|
||||||
|
"pm.max_requests" = 500;
|
||||||
|
"pm.max_spare_servers" = 3;
|
||||||
|
"pm.min_spare_servers" = 1;
|
||||||
|
"pm.start_servers" = 2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
testScript = { ... }: ''
|
||||||
|
machine.wait_for_unit("nginx.service")
|
||||||
|
machine.wait_for_unit("phpfpm-foobar.service")
|
||||||
|
|
||||||
|
# Check so we get an evaluated PHP back
|
||||||
|
assert "PHP Version ${pkgs.php.version}" in machine.succeed("curl -vvv -s http://127.0.0.1:80/")
|
||||||
|
|
||||||
|
# Check so we have database and some other extensions loaded
|
||||||
|
assert "json" in machine.succeed("curl -vvv -s http://127.0.0.1:80/")
|
||||||
|
assert "opcache" in machine.succeed("curl -vvv -s http://127.0.0.1:80/")
|
||||||
|
assert "pdo_mysql" in machine.succeed("curl -vvv -s http://127.0.0.1:80/")
|
||||||
|
assert "pdo_pgsql" in machine.succeed("curl -vvv -s http://127.0.0.1:80/")
|
||||||
|
assert "pdo_sqlite" in machine.succeed("curl -vvv -s http://127.0.0.1:80/")
|
||||||
|
'';
|
||||||
|
})
|
@ -1,7 +1,6 @@
|
|||||||
|
let
|
||||||
let testString = "can-use-subgroups"; in
|
testString = "can-use-subgroups";
|
||||||
|
in import ../make-test-python.nix ({ ...}: {
|
||||||
import ./make-test-python.nix ({ ...}: {
|
|
||||||
name = "php-httpd-pcre-jit-test";
|
name = "php-httpd-pcre-jit-test";
|
||||||
machine = { lib, pkgs, ... }: {
|
machine = { lib, pkgs, ... }: {
|
||||||
time.timeZone = "UTC";
|
time.timeZone = "UTC";
|
||||||
@ -10,14 +9,12 @@ import ./make-test-python.nix ({ ...}: {
|
|||||||
adminAddr = "please@dont.contact";
|
adminAddr = "please@dont.contact";
|
||||||
enablePHP = true;
|
enablePHP = true;
|
||||||
phpOptions = "pcre.jit = true";
|
phpOptions = "pcre.jit = true";
|
||||||
extraConfig =
|
extraConfig = let
|
||||||
let
|
|
||||||
testRoot = pkgs.writeText "index.php"
|
testRoot = pkgs.writeText "index.php"
|
||||||
''
|
''
|
||||||
<?php
|
<?php
|
||||||
preg_match('/(${testString})/', '${testString}', $result);
|
preg_match('/(${testString})/', '${testString}', $result);
|
||||||
var_dump($result);
|
var_dump($result);
|
||||||
?>
|
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
''
|
''
|
@ -1,9 +1,11 @@
|
|||||||
{ stdenv, php, autoreconfHook, fetchurl, re2c }:
|
{ stdenv, lib, php, autoreconfHook, fetchurl, re2c }:
|
||||||
|
|
||||||
{ pname
|
{ pname
|
||||||
, version
|
, version
|
||||||
|
, internalDeps ? []
|
||||||
, buildInputs ? []
|
, buildInputs ? []
|
||||||
, nativeBuildInputs ? []
|
, nativeBuildInputs ? []
|
||||||
|
, postPhpize ? ""
|
||||||
, makeFlags ? []
|
, makeFlags ? []
|
||||||
, src ? fetchurl {
|
, src ? fetchurl {
|
||||||
url = "http://pecl.php.net/get/${pname}-${version}.tgz";
|
url = "http://pecl.php.net/get/${pname}-${version}.tgz";
|
||||||
@ -22,5 +24,11 @@ stdenv.mkDerivation (args // {
|
|||||||
|
|
||||||
makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags;
|
makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags;
|
||||||
|
|
||||||
autoreconfPhase = "phpize";
|
autoreconfPhase = ''
|
||||||
|
phpize
|
||||||
|
${postPhpize}
|
||||||
|
${lib.concatMapStringsSep "\n"
|
||||||
|
(dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}")
|
||||||
|
internalDeps}
|
||||||
|
'';
|
||||||
})
|
})
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
# pcre functionality is tested in nixos/tests/php-pcre.nix
|
# We have tests for PCRE and PHP-FPM in nixos/tests/php/ or
|
||||||
{ config, lib, stdenv, fetchurl
|
# both in the same attribute named nixosTests.php
|
||||||
, autoconf, automake, bison, file, flex, libtool, pkgconfig, re2c
|
|
||||||
, libxml2, readline, zlib, curl, postgresql, gettext
|
{ callPackage, config, fetchurl, lib, makeWrapper, stdenv, symlinkJoin
|
||||||
, openssl, pcre, pcre2, sqlite
|
, writeText , autoconf, automake, bison, flex, libtool, pkgconfig, re2c
|
||||||
, libxslt, bzip2, icu, openldap, cyrus_sasl, unixODBC
|
, apacheHttpd, libargon2, libxml2, pcre, pcre2 , systemd, valgrind
|
||||||
, uwimap, pam, gmp, apacheHttpd, libiconv, systemd, libsodium, html-tidy, libargon2
|
|
||||||
, gd, freetype, libXpm, libjpeg, libpng, libwebp
|
|
||||||
, libzip, valgrind, oniguruma, symlinkJoin, writeText
|
|
||||||
, makeWrapper, callPackage
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -15,182 +11,83 @@ let
|
|||||||
{ version
|
{ version
|
||||||
, sha256
|
, sha256
|
||||||
, extraPatches ? []
|
, extraPatches ? []
|
||||||
, withSystemd ? config.php.systemd or stdenv.isLinux
|
|
||||||
, imapSupport ? config.php.imap or (!stdenv.isDarwin)
|
# Sapi flags
|
||||||
, ldapSupport ? config.php.ldap or true
|
|
||||||
, mysqlndSupport ? config.php.mysqlnd or true
|
|
||||||
, mysqliSupport ? (config.php.mysqli or true) && (mysqlndSupport)
|
|
||||||
, pdo_mysqlSupport ? (config.php.pdo_mysql or true) && (mysqlndSupport)
|
|
||||||
, libxml2Support ? config.php.libxml2 or true
|
|
||||||
, apxs2Support ? config.php.apxs2 or (!stdenv.isDarwin)
|
|
||||||
, embedSupport ? config.php.embed or false
|
|
||||||
, bcmathSupport ? config.php.bcmath or true
|
|
||||||
, socketsSupport ? config.php.sockets or true
|
|
||||||
, curlSupport ? config.php.curl or true
|
|
||||||
, gettextSupport ? config.php.gettext or true
|
|
||||||
, pcntlSupport ? config.php.pcntl or true
|
|
||||||
, pdo_odbcSupport ? config.php.pdo_odbc or true
|
|
||||||
, postgresqlSupport ? config.php.postgresql or true
|
|
||||||
, pdo_pgsqlSupport ? config.php.pdo_pgsql or true
|
|
||||||
, readlineSupport ? config.php.readline or true
|
|
||||||
, sqliteSupport ? config.php.sqlite or true
|
|
||||||
, soapSupport ? (config.php.soap or true) && (libxml2Support)
|
|
||||||
, zlibSupport ? config.php.zlib or true
|
|
||||||
, opensslSupport ? config.php.openssl or true
|
|
||||||
, mbstringSupport ? config.php.mbstring or true
|
|
||||||
, gdSupport ? config.php.gd or true
|
|
||||||
, intlSupport ? config.php.intl or true
|
|
||||||
, exifSupport ? config.php.exif or true
|
|
||||||
, xslSupport ? config.php.xsl or false
|
|
||||||
, bz2Support ? config.php.bz2 or false
|
|
||||||
, zipSupport ? config.php.zip or true
|
|
||||||
, ftpSupport ? config.php.ftp or true
|
|
||||||
, fpmSupport ? config.php.fpm or true
|
|
||||||
, gmpSupport ? config.php.gmp or true
|
|
||||||
, ztsSupport ? (config.php.zts or false) || (apxs2Support)
|
|
||||||
, calendarSupport ? config.php.calendar or true
|
|
||||||
, sodiumSupport ? (config.php.sodium or true) && (lib.versionAtLeast version "7.2")
|
|
||||||
, tidySupport ? (config.php.tidy or false)
|
|
||||||
, argon2Support ? (config.php.argon2 or true) && (lib.versionAtLeast version "7.2")
|
|
||||||
, libzipSupport ? (config.php.libzip or true) && (lib.versionAtLeast version "7.2")
|
|
||||||
, phpdbgSupport ? config.php.phpdbg or true
|
|
||||||
, cgiSupport ? config.php.cgi or true
|
, cgiSupport ? config.php.cgi or true
|
||||||
, cliSupport ? config.php.cli or true
|
, cliSupport ? config.php.cli or true
|
||||||
|
, fpmSupport ? config.php.fpm or true
|
||||||
|
, pearSupport ? config.php.pear or true
|
||||||
, pharSupport ? config.php.phar or true
|
, pharSupport ? config.php.phar or true
|
||||||
, xmlrpcSupport ? (config.php.xmlrpc or false) && (libxml2Support)
|
, phpdbgSupport ? config.php.phpdbg or true
|
||||||
|
|
||||||
|
|
||||||
|
# Misc flags
|
||||||
|
, apxs2Support ? config.php.apxs2 or (!stdenv.isDarwin)
|
||||||
|
, argon2Support ? config.php.argon2 or true
|
||||||
, cgotoSupport ? config.php.cgoto or false
|
, cgotoSupport ? config.php.cgoto or false
|
||||||
, valgrindSupport ? (config.php.valgrind or true) && (lib.versionAtLeast version "7.2")
|
, embedSupport ? config.php.embed or false
|
||||||
, ipv6Support ? config.php.ipv6 or true
|
, ipv6Support ? config.php.ipv6 or true
|
||||||
, pearSupport ? (config.php.pear or true) && (libxml2Support)
|
, systemdSupport ? config.php.systemd or stdenv.isLinux
|
||||||
}: stdenv.mkDerivation {
|
, valgrindSupport ? config.php.valgrind or true
|
||||||
|
, ztsSupport ? (config.php.zts or false) || (apxs2Support)
|
||||||
|
}: let
|
||||||
|
pcre' = if (lib.versionAtLeast version "7.3") then pcre2 else pcre;
|
||||||
|
in stdenv.mkDerivation {
|
||||||
pname = "php";
|
pname = "php";
|
||||||
|
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
nativeBuildInputs = [ autoconf automake bison file flex libtool pkgconfig re2c ];
|
nativeBuildInputs = [ autoconf automake bison flex libtool pkgconfig re2c ];
|
||||||
|
|
||||||
buildInputs = [ ]
|
buildInputs =
|
||||||
++ lib.optional (lib.versionOlder version "7.3") pcre
|
# PCRE extension
|
||||||
++ lib.optional (lib.versionAtLeast version "7.3") pcre2
|
[ pcre' ]
|
||||||
++ lib.optional (lib.versionAtLeast version "7.4") oniguruma
|
|
||||||
++ lib.optional withSystemd systemd
|
# Enable sapis
|
||||||
++ lib.optionals imapSupport [ uwimap openssl pam ]
|
++ lib.optional pearSupport [ libxml2.dev ]
|
||||||
++ lib.optionals curlSupport [ curl openssl ]
|
|
||||||
++ lib.optionals ldapSupport [ openldap openssl ]
|
# Misc deps
|
||||||
++ lib.optionals gdSupport [ gd freetype libXpm libjpeg libpng libwebp ]
|
|
||||||
++ lib.optionals opensslSupport [ openssl openssl.dev ]
|
|
||||||
++ lib.optional apxs2Support apacheHttpd
|
++ lib.optional apxs2Support apacheHttpd
|
||||||
++ lib.optional (ldapSupport && stdenv.isLinux) cyrus_sasl
|
|
||||||
++ lib.optional zlibSupport zlib
|
|
||||||
++ lib.optional libxml2Support libxml2
|
|
||||||
++ lib.optional readlineSupport readline
|
|
||||||
++ lib.optional sqliteSupport sqlite
|
|
||||||
++ lib.optional postgresqlSupport postgresql
|
|
||||||
++ lib.optional pdo_odbcSupport unixODBC
|
|
||||||
++ lib.optional pdo_pgsqlSupport postgresql
|
|
||||||
++ lib.optional gmpSupport gmp
|
|
||||||
++ lib.optional gettextSupport gettext
|
|
||||||
++ lib.optional intlSupport icu
|
|
||||||
++ lib.optional xslSupport libxslt
|
|
||||||
++ lib.optional bz2Support bzip2
|
|
||||||
++ lib.optional sodiumSupport libsodium
|
|
||||||
++ lib.optional tidySupport html-tidy
|
|
||||||
++ lib.optional argon2Support libargon2
|
++ lib.optional argon2Support libargon2
|
||||||
++ lib.optional libzipSupport libzip
|
++ lib.optional systemdSupport systemd
|
||||||
++ lib.optional valgrindSupport valgrind;
|
++ lib.optional valgrindSupport valgrind
|
||||||
|
;
|
||||||
|
|
||||||
CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
|
CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
|
||||||
|
|
||||||
configureFlags = [ "--with-config-file-scan-dir=/etc/php.d" ]
|
configureFlags =
|
||||||
++ lib.optionals (lib.versionOlder version "7.3") [ "--with-pcre-regex=${pcre.dev}" "PCRE_LIBDIR=${pcre}" ]
|
# Disable all extensions
|
||||||
++ lib.optionals (lib.versions.majorMinor version == "7.3") [ "--with-pcre-regex=${pcre2.dev}" "PCRE_LIBDIR=${pcre2}" ]
|
[ "--disable-all" ]
|
||||||
++ lib.optionals (lib.versionAtLeast version "7.4") [ "--with-external-pcre=${pcre2.dev}" "PCRE_LIBDIR=${pcre2}" ]
|
|
||||||
++ lib.optional stdenv.isDarwin "--with-iconv=${libiconv}"
|
# PCRE
|
||||||
++ lib.optional withSystemd "--with-fpm-systemd"
|
++ lib.optionals (lib.versionAtLeast version "7.4") [ "--with-external-pcre=${pcre'.dev}" ]
|
||||||
++ lib.optionals imapSupport [
|
++ lib.optionals (lib.versions.majorMinor version == "7.3") [ "--with-pcre-regex=${pcre'.dev}" ]
|
||||||
"--with-imap=${uwimap}"
|
++ lib.optionals (lib.versionOlder version "7.3") [ "--with-pcre-regex=${pcre'.dev}" ]
|
||||||
"--with-imap-ssl"
|
++ [ "PCRE_LIBDIR=${pcre'}" ]
|
||||||
]
|
|
||||||
++ lib.optionals ldapSupport [
|
|
||||||
"--with-ldap=/invalid/path"
|
# Enable sapis
|
||||||
"LDAP_DIR=${openldap.dev}"
|
|
||||||
"LDAP_INCDIR=${openldap.dev}/include"
|
|
||||||
"LDAP_LIBDIR=${openldap.out}/lib"
|
|
||||||
]
|
|
||||||
++ lib.optional (ldapSupport && stdenv.isLinux) "--with-ldap-sasl=${cyrus_sasl.dev}"
|
|
||||||
++ lib.optional apxs2Support "--with-apxs2=${apacheHttpd.dev}/bin/apxs"
|
|
||||||
++ lib.optional embedSupport "--enable-embed"
|
|
||||||
++ lib.optional curlSupport "--with-curl=${curl.dev}"
|
|
||||||
++ lib.optional zlibSupport "--with-zlib=${zlib.dev}"
|
|
||||||
++ lib.optional (libxml2Support && (lib.versionOlder version "7.4")) "--with-libxml-dir=${libxml2.dev}"
|
|
||||||
++ lib.optional (!libxml2Support) [
|
|
||||||
"--disable-dom"
|
|
||||||
(if (lib.versionOlder version "7.4") then "--disable-libxml" else "--without-libxml")
|
|
||||||
"--disable-simplexml"
|
|
||||||
"--disable-xml"
|
|
||||||
"--disable-xmlreader"
|
|
||||||
"--disable-xmlwriter"
|
|
||||||
"--without-pear"
|
|
||||||
]
|
|
||||||
++ lib.optional pcntlSupport "--enable-pcntl"
|
|
||||||
++ lib.optional readlineSupport "--with-readline=${readline.dev}"
|
|
||||||
++ lib.optional sqliteSupport "--with-pdo-sqlite=${sqlite.dev}"
|
|
||||||
++ lib.optional postgresqlSupport "--with-pgsql=${postgresql}"
|
|
||||||
++ lib.optional pdo_odbcSupport "--with-pdo-odbc=unixODBC,${unixODBC}"
|
|
||||||
++ lib.optional pdo_pgsqlSupport "--with-pdo-pgsql=${postgresql}"
|
|
||||||
++ lib.optional (pdo_mysqlSupport && mysqlndSupport) "--with-pdo-mysql=mysqlnd"
|
|
||||||
++ lib.optional (mysqliSupport && mysqlndSupport) "--with-mysqli=mysqlnd"
|
|
||||||
++ lib.optional (pdo_mysqlSupport || mysqliSupport) "--with-mysql-sock=/run/mysqld/mysqld.sock"
|
|
||||||
++ lib.optional bcmathSupport "--enable-bcmath"
|
|
||||||
++ lib.optionals (gdSupport && lib.versionAtLeast version "7.4") [
|
|
||||||
"--enable-gd"
|
|
||||||
"--with-external-gd=${gd.dev}"
|
|
||||||
"--with-webp=${libwebp}"
|
|
||||||
"--with-jpeg=${libjpeg.dev}"
|
|
||||||
"--with-xpm=${libXpm.dev}"
|
|
||||||
"--with-freetype=${freetype.dev}"
|
|
||||||
"--enable-gd-jis-conv"
|
|
||||||
] ++ lib.optionals (gdSupport && lib.versionOlder version "7.4") [
|
|
||||||
"--with-gd=${gd.dev}"
|
|
||||||
"--with-webp-dir=${libwebp}"
|
|
||||||
"--with-jpeg-dir=${libjpeg.dev}"
|
|
||||||
"--with-png-dir=${libpng.dev}"
|
|
||||||
"--with-freetype-dir=${freetype.dev}"
|
|
||||||
"--with-xpm-dir=${libXpm.dev}"
|
|
||||||
"--enable-gd-jis-conv"
|
|
||||||
]
|
|
||||||
++ lib.optional gmpSupport "--with-gmp=${gmp.dev}"
|
|
||||||
++ lib.optional soapSupport "--enable-soap"
|
|
||||||
++ lib.optional socketsSupport "--enable-sockets"
|
|
||||||
++ lib.optional opensslSupport "--with-openssl"
|
|
||||||
++ lib.optional mbstringSupport "--enable-mbstring"
|
|
||||||
++ lib.optional gettextSupport "--with-gettext=${gettext}"
|
|
||||||
++ lib.optional intlSupport "--enable-intl"
|
|
||||||
++ lib.optional exifSupport "--enable-exif"
|
|
||||||
++ lib.optional xslSupport "--with-xsl=${libxslt.dev}"
|
|
||||||
++ lib.optional bz2Support "--with-bz2=${bzip2.dev}"
|
|
||||||
++ lib.optional (zipSupport && (lib.versionOlder version "7.4")) "--enable-zip"
|
|
||||||
++ lib.optional (zipSupport && (lib.versionAtLeast version "7.4")) "--with-zip"
|
|
||||||
++ lib.optional ftpSupport "--enable-ftp"
|
|
||||||
++ lib.optional fpmSupport "--enable-fpm"
|
|
||||||
++ lib.optional ztsSupport "--enable-maintainer-zts"
|
|
||||||
++ lib.optional calendarSupport "--enable-calendar"
|
|
||||||
++ lib.optional sodiumSupport "--with-sodium=${libsodium.dev}"
|
|
||||||
++ lib.optional tidySupport "--with-tidy=${html-tidy}"
|
|
||||||
++ lib.optional argon2Support "--with-password-argon2=${libargon2}"
|
|
||||||
++ lib.optional (libzipSupport && (lib.versionOlder version "7.4")) "--with-libzip=${libzip.dev}"
|
|
||||||
++ lib.optional phpdbgSupport "--enable-phpdbg"
|
|
||||||
++ lib.optional (!phpdbgSupport) "--disable-phpdbg"
|
|
||||||
++ lib.optional (!cgiSupport) "--disable-cgi"
|
++ lib.optional (!cgiSupport) "--disable-cgi"
|
||||||
++ lib.optional (!cliSupport) "--disable-cli"
|
++ lib.optional (!cliSupport) "--disable-cli"
|
||||||
++ lib.optional (!pharSupport) "--disable-phar"
|
++ lib.optional fpmSupport "--enable-fpm"
|
||||||
++ lib.optional xmlrpcSupport "--with-xmlrpc"
|
++ lib.optional pearSupport [ "--with-pear=$(out)/lib/php/pear" "--enable-xml" "--with-libxml" ]
|
||||||
|
++ lib.optional (pearSupport && (lib.versionOlder version "7.4")) "--enable-libxml"
|
||||||
|
++ lib.optional pharSupport "--enable-phar"
|
||||||
|
++ lib.optional phpdbgSupport "--enable-phpdbg"
|
||||||
|
|
||||||
|
|
||||||
|
# Misc flags
|
||||||
|
++ lib.optional apxs2Support "--with-apxs2=${apacheHttpd.dev}/bin/apxs"
|
||||||
|
++ lib.optional argon2Support "--with-password-argon2=${libargon2}"
|
||||||
++ lib.optional cgotoSupport "--enable-re2c-cgoto"
|
++ lib.optional cgotoSupport "--enable-re2c-cgoto"
|
||||||
++ lib.optional valgrindSupport "--with-valgrind=${valgrind.dev}"
|
++ lib.optional embedSupport "--enable-embed"
|
||||||
++ lib.optional (!ipv6Support) "--disable-ipv6"
|
++ lib.optional (!ipv6Support) "--disable-ipv6"
|
||||||
++ lib.optional (pearSupport && libxml2Support) "--with-pear=$(out)/lib/php/pear";
|
++ lib.optional systemdSupport "--with-fpm-systemd"
|
||||||
|
++ lib.optional valgrindSupport "--with-valgrind=${valgrind.dev}"
|
||||||
|
++ lib.optional ztsSupport "--enable-maintainer-zts"
|
||||||
|
;
|
||||||
|
|
||||||
hardeningDisable = [ "bindnow" ];
|
hardeningDisable = [ "bindnow" ];
|
||||||
|
|
||||||
@ -204,8 +101,6 @@ let
|
|||||||
--replace '@PHP_LDFLAGS@' ""
|
--replace '@PHP_LDFLAGS@' ""
|
||||||
done
|
done
|
||||||
|
|
||||||
substituteInPlace ./build/libtool.m4 --replace /usr/bin/file ${file}/bin/file
|
|
||||||
|
|
||||||
export EXTENSION_DIR=$out/lib/php/extensions
|
export EXTENSION_DIR=$out/lib/php/extensions
|
||||||
|
|
||||||
./buildconf --copy --force
|
./buildconf --copy --force
|
||||||
@ -235,6 +130,12 @@ let
|
|||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [ ./fix-paths-php7.patch ] ++ extraPatches;
|
||||||
|
|
||||||
|
separateDebugInfo = true;
|
||||||
|
|
||||||
|
outputs = [ "out" "dev" ];
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "An HTML-embedded scripting language";
|
description = "An HTML-embedded scripting language";
|
||||||
homepage = "https://www.php.net/";
|
homepage = "https://www.php.net/";
|
||||||
@ -243,57 +144,121 @@ let
|
|||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
outputsToInstall = [ "out" "dev" ];
|
outputsToInstall = [ "out" "dev" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [ ./fix-paths-php7.patch ] ++ extraPatches;
|
|
||||||
|
|
||||||
stripDebugList = "bin sbin lib modules";
|
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
generic' = { version, sha256, ... }@args: let php = generic args; in php.overrideAttrs (_: {
|
generic' = { version, sha256, self, selfWithExtensions, ... }@args:
|
||||||
passthru.buildEnv = { exts ? (_: []), extraConfig ? "" }: let
|
let
|
||||||
extraInit = writeText "custom-php.ini" ''
|
php = generic (builtins.removeAttrs args [ "self" "selfWithExtensions" ]);
|
||||||
${extraConfig}
|
|
||||||
${lib.concatMapStringsSep "\n" (ext: let
|
php-packages = (callPackage ../../../top-level/php-packages.nix {
|
||||||
extName = lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
|
php = self;
|
||||||
|
phpWithExtensions = selfWithExtensions;
|
||||||
|
});
|
||||||
|
|
||||||
|
buildEnv = { extensions ? (_: []), extraConfig ? "" }:
|
||||||
|
let
|
||||||
|
getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
|
||||||
|
enabledExtensions = extensions php-packages.extensions;
|
||||||
|
|
||||||
|
# Generate extension load configuration snippets from the
|
||||||
|
# extension parameter. This is an attrset suitable for use
|
||||||
|
# with textClosureList, which is used to put the strings in
|
||||||
|
# the right order - if a plugin which is dependent on
|
||||||
|
# another plugin is placed before its dependency, it will
|
||||||
|
# fail to load.
|
||||||
|
extensionTexts =
|
||||||
|
lib.listToAttrs
|
||||||
|
(map (ext:
|
||||||
|
let
|
||||||
|
extName = getExtName ext;
|
||||||
type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension";
|
type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension";
|
||||||
in ''
|
in
|
||||||
${type}=${ext}/lib/php/extensions/${extName}.so
|
lib.nameValuePair extName {
|
||||||
'') (exts (callPackage ../../../top-level/php-packages.nix { inherit php; }))}
|
text = "${type}=${ext}/lib/php/extensions/${extName}.so";
|
||||||
|
deps = lib.optionals (ext ? internalDeps)
|
||||||
|
(map getExtName ext.internalDeps);
|
||||||
|
})
|
||||||
|
enabledExtensions);
|
||||||
|
|
||||||
|
extNames = map getExtName enabledExtensions;
|
||||||
|
extraInit = writeText "custom-php.ini" ''
|
||||||
|
${lib.concatStringsSep "\n"
|
||||||
|
(lib.textClosureList extensionTexts extNames)}
|
||||||
|
${extraConfig}
|
||||||
'';
|
'';
|
||||||
in symlinkJoin {
|
in
|
||||||
name = "php-custom-${version}";
|
symlinkJoin {
|
||||||
|
name = "php-with-extensions-${version}";
|
||||||
|
inherit (php) version dev;
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
passthru = {
|
||||||
|
inherit buildEnv withExtensions enabledExtensions;
|
||||||
|
inherit (php-packages) packages extensions;
|
||||||
|
};
|
||||||
paths = [ php ];
|
paths = [ php ];
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
wrapProgram $out/bin/php \
|
cp ${extraInit} $out/lib/custom-php.ini
|
||||||
--add-flags "-c ${extraInit}"
|
|
||||||
wrapProgram $out/bin/php-fpm \
|
wrapProgram $out/bin/php --set PHP_INI_SCAN_DIR $out/lib
|
||||||
--add-flags "-c ${extraInit}"
|
|
||||||
|
if test -e $out/bin/php-fpm; then
|
||||||
|
wrapProgram $out/bin/php-fpm --set PHP_INI_SCAN_DIR $out/lib
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
withExtensions = extensions: buildEnv { inherit extensions; };
|
||||||
|
in
|
||||||
|
php.overrideAttrs (_: {
|
||||||
|
passthru = {
|
||||||
|
enabledExtensions = [];
|
||||||
|
inherit buildEnv withExtensions;
|
||||||
|
inherit (php-packages) packages extensions;
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
in {
|
php72base = generic' {
|
||||||
php72 = generic' {
|
|
||||||
version = "7.2.28";
|
version = "7.2.28";
|
||||||
sha256 = "18sjvl67z5a2x5s2a36g6ls1r3m4hbrsw52hqr2qsgfvg5dkm5bw";
|
sha256 = "18sjvl67z5a2x5s2a36g6ls1r3m4hbrsw52hqr2qsgfvg5dkm5bw";
|
||||||
|
self = php72base;
|
||||||
|
selfWithExtensions = php72;
|
||||||
|
|
||||||
# https://bugs.php.net/bug.php?id=76826
|
# https://bugs.php.net/bug.php?id=76826
|
||||||
extraPatches = lib.optional stdenv.isDarwin ./php72-darwin-isfinite.patch;
|
extraPatches = lib.optional stdenv.isDarwin ./php72-darwin-isfinite.patch;
|
||||||
};
|
};
|
||||||
|
|
||||||
php73 = generic' {
|
php73base = generic' {
|
||||||
version = "7.3.15";
|
version = "7.3.15";
|
||||||
sha256 = "0g84hws15s8gh8iq4h6q747dyfazx47vh3da3whz8d80x83ibgld";
|
sha256 = "0g84hws15s8gh8iq4h6q747dyfazx47vh3da3whz8d80x83ibgld";
|
||||||
|
self = php73base;
|
||||||
|
selfWithExtensions = php73;
|
||||||
|
|
||||||
# https://bugs.php.net/bug.php?id=76826
|
# https://bugs.php.net/bug.php?id=76826
|
||||||
extraPatches = lib.optional stdenv.isDarwin ./php73-darwin-isfinite.patch;
|
extraPatches = lib.optional stdenv.isDarwin ./php73-darwin-isfinite.patch;
|
||||||
};
|
};
|
||||||
|
|
||||||
php74 = generic' {
|
php74base = generic' {
|
||||||
version = "7.4.3";
|
version = "7.4.3";
|
||||||
sha256 = "wVF7pJV4+y3MZMc6Ptx21PxQfEp6xjmYFYTMfTtMbRQ=";
|
sha256 = "wVF7pJV4+y3MZMc6Ptx21PxQfEp6xjmYFYTMfTtMbRQ=";
|
||||||
|
self = php74base;
|
||||||
|
selfWithExtensions = php74;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultPhpExtensions = extensions: with extensions; ([
|
||||||
|
bcmath calendar curl ctype dom exif fileinfo filter ftp gd
|
||||||
|
gettext gmp iconv intl json ldap mbstring mysqli mysqlnd opcache
|
||||||
|
openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql
|
||||||
|
posix readline session simplexml sockets soap sodium sqlite3
|
||||||
|
tokenizer xmlreader xmlwriter zip zlib
|
||||||
|
] ++ lib.optionals (!stdenv.isDarwin) [ imap ]);
|
||||||
|
|
||||||
|
defaultPhpExtensionsWithHash = extensions:
|
||||||
|
(defaultPhpExtensions extensions) ++ [ extensions.hash ];
|
||||||
|
|
||||||
|
php74 = php74base.withExtensions defaultPhpExtensions;
|
||||||
|
php73 = php73base.withExtensions defaultPhpExtensionsWithHash;
|
||||||
|
php72 = php72base.withExtensions defaultPhpExtensionsWithHash;
|
||||||
|
|
||||||
|
in {
|
||||||
|
inherit php72base php73base php74base php72 php73 php74;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,19 @@
|
|||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
let
|
||||||
|
phpConfig = {
|
||||||
|
config.php.embed = true;
|
||||||
|
config.php.apxs2 = false;
|
||||||
|
config.php.systemd = false;
|
||||||
|
config.php.phpdbg = false;
|
||||||
|
config.php.cgi = false;
|
||||||
|
config.php.fpm = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
php72-unit = php72.override phpConfig;
|
||||||
|
php73-unit = php73.override phpConfig;
|
||||||
|
in stdenv.mkDerivation rec {
|
||||||
version = "1.16.0";
|
version = "1.16.0";
|
||||||
pname = "unit";
|
pname = "unit";
|
||||||
|
|
||||||
@ -37,8 +49,8 @@ stdenv.mkDerivation rec {
|
|||||||
buildInputs = [ ]
|
buildInputs = [ ]
|
||||||
++ optional withPython2 python2
|
++ optional withPython2 python2
|
||||||
++ optionals withPython3 [ python3 ncurses ]
|
++ optionals withPython3 [ python3 ncurses ]
|
||||||
++ optional withPHP72 php72
|
++ optional withPHP72 php72-unit
|
||||||
++ optional withPHP73 php73
|
++ optional withPHP73 php73-unit
|
||||||
++ optional withPerl528 perl528
|
++ optional withPerl528 perl528
|
||||||
++ optional withPerl530 perl530
|
++ optional withPerl530 perl530
|
||||||
++ optional withPerldevel perldevel
|
++ optional withPerldevel perldevel
|
||||||
@ -59,8 +71,8 @@ stdenv.mkDerivation rec {
|
|||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
${optionalString withPython2 "./configure python --module=python2 --config=${python2}/bin/python2-config --lib-path=${python2}/lib"}
|
${optionalString withPython2 "./configure python --module=python2 --config=${python2}/bin/python2-config --lib-path=${python2}/lib"}
|
||||||
${optionalString withPython3 "./configure python --module=python3 --config=${python3}/bin/python3-config --lib-path=${python3}/lib"}
|
${optionalString withPython3 "./configure python --module=python3 --config=${python3}/bin/python3-config --lib-path=${python3}/lib"}
|
||||||
${optionalString withPHP72 "./configure php --module=php72 --config=${php72.dev}/bin/php-config --lib-path=${php72}/lib"}
|
${optionalString withPHP72 "./configure php --module=php72 --config=${php72-unit.dev}/bin/php-config --lib-path=${php72-unit}/lib"}
|
||||||
${optionalString withPHP73 "./configure php --module=php73 --config=${php73.dev}/bin/php-config --lib-path=${php73}/lib"}
|
${optionalString withPHP73 "./configure php --module=php73 --config=${php73-unit.dev}/bin/php-config --lib-path=${php73-unit}/lib"}
|
||||||
${optionalString withPerl528 "./configure perl --module=perl528 --perl=${perl528}/bin/perl"}
|
${optionalString withPerl528 "./configure perl --module=perl528 --perl=${perl528}/bin/perl"}
|
||||||
${optionalString withPerl530 "./configure perl --module=perl530 --perl=${perl530}/bin/perl"}
|
${optionalString withPerl530 "./configure perl --module=perl530 --perl=${perl530}/bin/perl"}
|
||||||
${optionalString withPerldevel "./configure perl --module=perldev --perl=${perldevel}/bin/perl"}
|
${optionalString withPerldevel "./configure perl --module=perldev --perl=${perldevel}/bin/perl"}
|
||||||
|
@ -4,10 +4,15 @@
|
|||||||
, pam, withPAM ? stdenv.isLinux
|
, pam, withPAM ? stdenv.isLinux
|
||||||
, systemd, withSystemd ? stdenv.isLinux
|
, systemd, withSystemd ? stdenv.isLinux
|
||||||
, python2, python3, ncurses
|
, python2, python3, ncurses
|
||||||
, ruby, php-embed, libmysqlclient
|
, ruby, php, libmysqlclient
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let pythonPlugin = pkg : lib.nameValuePair "python${if pkg.isPy2 then "2" else "3"}" {
|
let php-embed = php.override {
|
||||||
|
config.php.embed = true;
|
||||||
|
config.php.apxs2 = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
pythonPlugin = pkg : lib.nameValuePair "python${if pkg.isPy2 then "2" else "3"}" {
|
||||||
interpreter = pkg.interpreter;
|
interpreter = pkg.interpreter;
|
||||||
path = "plugins/python";
|
path = "plugins/python";
|
||||||
inputs = [ pkg ncurses ];
|
inputs = [ pkg ncurses ];
|
||||||
|
@ -322,6 +322,55 @@ mapAliases ({
|
|||||||
perlArchiveCpio = perlPackages.ArchiveCpio; # added 2018-10-12
|
perlArchiveCpio = perlPackages.ArchiveCpio; # added 2018-10-12
|
||||||
pgp-tools = signing-party; # added 2017-03-26
|
pgp-tools = signing-party; # added 2017-03-26
|
||||||
pg_tmp = ephemeralpg; # added 2018-01-16
|
pg_tmp = ephemeralpg; # added 2018-01-16
|
||||||
|
|
||||||
|
php-embed = throw ''
|
||||||
|
php*-embed has been dropped, you can build the same package by using
|
||||||
|
something similar with this following snippet:
|
||||||
|
(php74.override { config.php.embed = true; config.php.apxs2 = false; })
|
||||||
|
''; # added 2020-04-01
|
||||||
|
php72-embed = php-embed; # added 2020-04-01
|
||||||
|
php73-embed = php-embed; # added 2020-04-01
|
||||||
|
php74-embed = php-embed; # added 2020-04-01
|
||||||
|
|
||||||
|
phpPackages-embed = throw ''
|
||||||
|
php*Packages-embed has been dropped, you can build the same package by using
|
||||||
|
something similar with this following snippet:
|
||||||
|
(php74.override { config.php.embed = true; config.php.apxs2 = false; }).packages
|
||||||
|
''; # added 2020-04-01
|
||||||
|
php74Packages-embed = phpPackages-embed;
|
||||||
|
php73Packages-embed = phpPackages-embed;
|
||||||
|
php72Packages-embed = phpPackages-embed;
|
||||||
|
|
||||||
|
php-unit = throw ''
|
||||||
|
php*-unit has been dropped, you can build the same package by using
|
||||||
|
something similar with this following snippet:
|
||||||
|
(php74.override {
|
||||||
|
config.php.embed = true;
|
||||||
|
config.php.apxs2 = false;
|
||||||
|
config.php.systemd = false;
|
||||||
|
config.php.phpdbg = false;
|
||||||
|
config.php.cgi = false;
|
||||||
|
config.php.fpm = false; })
|
||||||
|
''; # added 2020-04-01
|
||||||
|
php72-unit = php-unit; # added 2020-04-01
|
||||||
|
php73-unit = php-unit; # added 2020-04-01
|
||||||
|
php74-unit = php-unit; # added 2020-04-01
|
||||||
|
|
||||||
|
phpPackages-unit = throw ''
|
||||||
|
php*Packages-unit has been dropped, you can build the same package by using
|
||||||
|
something similar with this following snippet:
|
||||||
|
(php74.override {
|
||||||
|
config.php.embed = true;
|
||||||
|
config.php.apxs2 = false;
|
||||||
|
config.php.systemd = false;
|
||||||
|
config.php.phpdbg = false;
|
||||||
|
config.php.cgi = false;
|
||||||
|
config.php.fpm = false; }).packages
|
||||||
|
''; # added 2020-04-01
|
||||||
|
php74Packages-unit = phpPackages-unit;
|
||||||
|
php73Packages-unit = phpPackages-unit;
|
||||||
|
php72Packages-unit = phpPackages-unit;
|
||||||
|
|
||||||
pidgin-with-plugins = pidgin; # added 2016-06
|
pidgin-with-plugins = pidgin; # added 2016-06
|
||||||
pidginlatex = pidgin-latex; # added 2018-01-08
|
pidginlatex = pidgin-latex; # added 2018-01-08
|
||||||
pidginlatexSF = pidgin-latex; # added 2014-11-02
|
pidginlatexSF = pidgin-latex; # added 2014-11-02
|
||||||
|
@ -9391,86 +9391,20 @@ in
|
|||||||
pachyderm = callPackage ../applications/networking/cluster/pachyderm { };
|
pachyderm = callPackage ../applications/networking/cluster/pachyderm { };
|
||||||
|
|
||||||
php = php74;
|
php = php74;
|
||||||
|
|
||||||
phpPackages = php74Packages;
|
phpPackages = php74Packages;
|
||||||
|
php72Packages = recurseIntoAttrs php72.packages;
|
||||||
|
php73Packages = recurseIntoAttrs php73.packages;
|
||||||
|
php74Packages = recurseIntoAttrs php74.packages;
|
||||||
|
|
||||||
php72Packages = recurseIntoAttrs (callPackage ./php-packages.nix {
|
phpExtensions = php74Extensions;
|
||||||
php = php72;
|
php72Extensions = recurseIntoAttrs php72.extensions;
|
||||||
});
|
php73Extensions = recurseIntoAttrs php73.extensions;
|
||||||
|
php74Extensions = recurseIntoAttrs php74.extensions;
|
||||||
php73Packages = recurseIntoAttrs (callPackage ./php-packages.nix {
|
|
||||||
php = php73;
|
|
||||||
});
|
|
||||||
|
|
||||||
php74Packages = recurseIntoAttrs (callPackage ./php-packages.nix {
|
|
||||||
php = php74;
|
|
||||||
});
|
|
||||||
|
|
||||||
phpPackages-unit = php74Packages-unit;
|
|
||||||
|
|
||||||
php72Packages-unit = recurseIntoAttrs (callPackage ./php-packages.nix {
|
|
||||||
php = php72-unit;
|
|
||||||
});
|
|
||||||
|
|
||||||
php73Packages-unit = recurseIntoAttrs (callPackage ./php-packages.nix {
|
|
||||||
php = php73-unit;
|
|
||||||
});
|
|
||||||
|
|
||||||
php74Packages-unit = recurseIntoAttrs (callPackage ./php-packages.nix {
|
|
||||||
php = php74-unit;
|
|
||||||
});
|
|
||||||
|
|
||||||
inherit (callPackages ../development/interpreters/php {
|
inherit (callPackages ../development/interpreters/php {
|
||||||
stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv;
|
stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv;
|
||||||
})
|
}) php74 php73 php72 php74base php73base php72base;
|
||||||
php74
|
|
||||||
php73
|
|
||||||
php72;
|
|
||||||
|
|
||||||
php-embed = php74-embed;
|
|
||||||
|
|
||||||
php72-embed = php72.override {
|
|
||||||
config.php.embed = true;
|
|
||||||
config.php.apxs2 = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
php73-embed = php73.override {
|
|
||||||
config.php.embed = true;
|
|
||||||
config.php.apxs2 = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
php74-embed = php74.override {
|
|
||||||
config.php.embed = true;
|
|
||||||
config.php.apxs2 = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
php-unit = php74-unit;
|
|
||||||
|
|
||||||
php72-unit = php72.override {
|
|
||||||
config.php.embed = true;
|
|
||||||
config.php.apxs2 = false;
|
|
||||||
config.php.systemd = false;
|
|
||||||
config.php.phpdbg = false;
|
|
||||||
config.php.cgi = false;
|
|
||||||
config.php.fpm = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
php73-unit = php73.override {
|
|
||||||
config.php.embed = true;
|
|
||||||
config.php.apxs2 = false;
|
|
||||||
config.php.systemd = false;
|
|
||||||
config.php.phpdbg = false;
|
|
||||||
config.php.cgi = false;
|
|
||||||
config.php.fpm = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
php74-unit = php74.override {
|
|
||||||
config.php.embed = true;
|
|
||||||
config.php.apxs2 = false;
|
|
||||||
config.php.systemd = false;
|
|
||||||
config.php.phpdbg = false;
|
|
||||||
config.php.cgi = false;
|
|
||||||
config.php.fpm = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
picoc = callPackage ../development/interpreters/picoc {};
|
picoc = callPackage ../development/interpreters/picoc {};
|
||||||
|
|
||||||
@ -15641,10 +15575,7 @@ in
|
|||||||
|
|
||||||
neard = callPackage ../servers/neard { };
|
neard = callPackage ../servers/neard { };
|
||||||
|
|
||||||
unit = callPackage ../servers/http/unit {
|
unit = callPackage ../servers/http/unit { };
|
||||||
php72 = php72-unit;
|
|
||||||
php73 = php73-unit;
|
|
||||||
};
|
|
||||||
|
|
||||||
nginx = nginxStable;
|
nginx = nginxStable;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user