php: split php.packages to php.packages and php.extensions

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 commit is contained in:
Elis Hirwing 2020-04-02 22:13:04 +02:00 committed by talyz
parent a4bc30c802
commit a2099156ec
No known key found for this signature in database
GPG Key ID: 2DED2151F4671A2B
6 changed files with 613 additions and 603 deletions

View File

@ -21,20 +21,12 @@ of a given NixOS release will be included in that release of
NixOS. See [PHP Supported
Versions](https://www.php.net/supported-versions.php).
As for packages we have `php.packages` that contains a bunch of
attributes where some are suitable as extensions (notable example:
`php.packages.imagick`). And some are more suitable for command
line use (notable example: `php.packages.composer`).
For packages we have `php.packages` that contains packages related
for human interaction, notable example is `php.packages.composer`.
We have a special section within `php.packages` called
`php.packages.exts` that contain certain PHP modules that may not
be part of the default PHP derivation (example:
`php.packages.exts.opcache`).
The `php.packages.exts.*` attributes are official extensions which
originate from the mainline PHP project, while other extensions within
the `php.packages.*` attribute are of mixed origin (such as `pecl`
and other places).
For extensions we have `php.extensions` that contains most upstream
extensions as separate attributes as well some additional extensions
that tend to be popular, notable example is: `php.extensions.imagick`.
The different versions of PHP that nixpkgs fetch is located under
attributes named based on major and minor version number; e.g.,
@ -43,23 +35,20 @@ attributes named based on major and minor version number; e.g.,
#### Installing PHP with packages
There's two different kinds of things you could install:
- A command line utility. Simply refer to it via
`php*.packages.*`, and it automatically comes with the necessary
PHP environment, certain extensions and libraries around it.
- A PHP interpreter with certain extensions available. The `php`
attribute provides `php.buildEnv` that allows you to wrap the PHP
derivation with an additional config file that makes PHP import
additional libraries or dependencies.
There's two majorly different parts of the PHP ecosystem in NixOS:
- Command line utilities for human interaction. These comes from the
`php.packages.*` attributes.
- PHP environments with different extensions enabled. These are
composed with `php.buildEnv` using an additional configuration file.
##### Example setup for `phpfpm`
Example to build a PHP with `imagick` and `opcache` enabled, and
configure it for the "foo" `phpfpm` pool:
Example to build a PHP with the extensions `imagick` and `opcache`
enabled. Then to configure it for the "foo" `phpfpm` pool:
```nix
let
myPhp = php.buildEnv { exts = pp: with pp; [ imagick exts.opcache ]; };
myPhp = php.buildEnv { exts = pp: with pp; [ imagick opcache ]; };
in {
services.phpfpm.pools."foo".phpPackage = myPhp;
};
@ -68,8 +57,8 @@ in {
##### Example usage with `nix-shell`
This brings up a temporary environment that contains a PHP interpreter
with `imagick` and `opcache` enabled.
with the extensions `imagick` and `opcache` enabled.
```sh
nix-shell -p 'php.buildEnv { exts = pp: with pp; [ imagick exts.opcache ]; }'
nix-shell -p 'php.buildEnv { exts = pp: with pp; [ imagick opcache ]; }'
```

View File

@ -134,8 +134,8 @@
<programlisting>
environment.systemPackages = [
(pkgs.php.buildEnv { exts = pp: with pp.exts; [
pp.imagick
(pkgs.php.buildEnv { exts = pp: with pp; [
imagick
opcache
pdo_mysql
]; })
@ -144,7 +144,7 @@ environment.systemPackages = [
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.packages.exts.<name?>]]></package>.
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

View File

@ -7,12 +7,12 @@ let
fpm = config.services.phpfpm.pools.nextcloud;
phpPackage = pkgs.php74.buildEnv {
exts = pp: with pp.exts; [
exts = pp: with pp; [
bcmath calendar curl exif ftp filter gd gettext gmp intl json ldap
mysqlnd opcache openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql
pdo_sqlite pgsql readline session soap sodium sqlite3 zip zlib mbstring
posix ctype dom simplexml xmlreader xmlwriter pp.apcu
pp.redis pp.memcached pp.imagick
posix ctype dom simplexml xmlreader xmlwriter
apcu redis memcached imagick
];
extraConfig = phpOptionsStr;
};

View File

@ -149,14 +149,21 @@ let
generic' = { version, sha256, self, selfWithExtensions, ... }@args:
let
php = generic (builtins.removeAttrs args [ "self" "selfWithExtensions" ]);
packages = callPackage ../../../top-level/php-packages.nix {
packages = (callPackage ../../../top-level/php-packages.nix {
php = self;
phpWithExtensions = selfWithExtensions;
};
}).packages;
extensions = (callPackage ../../../top-level/php-packages.nix {
php = self;
phpWithExtensions = selfWithExtensions;
}).extensions;
buildEnv = { exts ? (_: []), extraConfig ? "" }:
let
getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
extList = exts packages;
extList = exts extensions;
# Generate extension load configuration snippets from
# exts. This is an attrset suitable for use with
@ -190,7 +197,7 @@ let
inherit version;
nativeBuildInputs = [ makeWrapper ];
passthru = {
inherit buildEnv packages;
inherit buildEnv packages extensions;
};
paths = [ php ];
postBuild = ''
@ -206,7 +213,7 @@ let
in
php.overrideAttrs (_: {
passthru = {
inherit buildEnv packages;
inherit buildEnv packages extensions;
};
});
@ -238,7 +245,7 @@ let
};
defaultPhpExtensions = {
exts = pp: with pp.exts; ([
exts = pp: with pp; ([
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

View File

@ -9377,6 +9377,11 @@ in
php73Packages = recurseIntoAttrs php73.packages;
php74Packages = recurseIntoAttrs php74.packages;
phpExtensions = php74Extensions;
php72Extensions = recurseIntoAttrs php72.extensions;
php73Extensions = recurseIntoAttrs php73.extensions;
php74Extensions = recurseIntoAttrs php74.extensions;
inherit (callPackages ../development/interpreters/php {
stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv;
}) php74 php73 php72 php74base php73base php72base;

View File

@ -20,43 +20,15 @@ let
isPhp73 = pkgs.lib.versionAtLeast php.version "7.3";
isPhp74 = pkgs.lib.versionAtLeast php.version "7.4";
pcre' = if (lib.versionAtLeast php.version "7.3") then pcre2 else pcre;
in
{
inherit buildPecl;
apcu = buildPecl {
version = "5.1.18";
pname = "apcu";
sha256 = "0ayykd4hfvdzk7qnr5k6yq5scwf6rb2i05xscfv76q5dmkkynvfl";
buildInputs = if isPhp73 then [ pkgs.pcre2 ] else [ pkgs.pcre ];
doCheck = true;
checkTarget = "test";
checkFlagsArray = ["REPORT_EXIT_STATUS=1" "NO_INTERACTION=1"];
makeFlags = [ "phpincludedir=$(dev)/include" ];
outputs = [ "out" "dev" ];
};
apcu_bc = buildPecl {
version = "1.0.5";
pname = "apcu_bc";
sha256 = "0ma00syhk2ps9k9p02jz7rii6x3i2p986il23703zz5npd6y9n20";
buildInputs = [
php.packages.apcu
(if isPhp73 then pkgs.pcre2 else pkgs.pcre)
];
};
ast = buildPecl {
version = "1.0.5";
pname = "ast";
sha256 = "16c5isldm4csjbcvz1qk2mmrhgvh24sxsp6w6f5a37xpa3vciawp";
};
# Packages are an attribute set meant for for human interaction and not
# extensions for the language itself.
packages = {
box = mkDerivation rec {
version = "2.7.5";
pname = "box";
@ -113,239 +85,6 @@ in
};
};
couchbase = buildPecl rec {
version = "2.6.1";
pname = "couchbase";
buildInputs = [
pkgs.libcouchbase
pkgs.zlib
php.packages.igbinary
php.packages.pcs
];
src = pkgs.fetchFromGitHub {
owner = "couchbase";
repo = "php-couchbase";
rev = "v${version}";
sha256 = "0jdzgcvab1vpxai23brmmvizjjq2d2dik9aklz6bzspfb512qjd6";
};
configureFlags = [ "--with-couchbase" ];
internalDeps = [ php.packages.exts.json ];
patches = [
(pkgs.writeText "php-couchbase.patch" ''
--- a/config.m4
+++ b/config.m4
@@ -9,7 +9,7 @@ if test "$PHP_COUCHBASE" != "no"; then
LIBCOUCHBASE_DIR=$PHP_COUCHBASE
else
AC_MSG_CHECKING(for libcouchbase in default path)
- for i in /usr/local /usr; do
+ for i in ${pkgs.libcouchbase}; do
if test -r $i/include/libcouchbase/couchbase.h; then
LIBCOUCHBASE_DIR=$i
AC_MSG_RESULT(found in $i)
@@ -154,6 +154,8 @@ COUCHBASE_FILES=" \
igbinary_inc_path="$phpincludedir"
elif test -f "$phpincludedir/ext/igbinary/igbinary.h"; then
igbinary_inc_path="$phpincludedir"
+ elif test -f "${php.packages.igbinary.dev}/include/ext/igbinary/igbinary.h"; then
+ igbinary_inc_path="${php.packages.igbinary.dev}/include"
fi
if test "$igbinary_inc_path" = ""; then
AC_MSG_WARN([Cannot find igbinary.h])
'')
];
meta.broken = isPhp74; # Build error
};
event = buildPecl {
version = "2.5.3";
pname = "event";
sha256 = "12liry5ldvgwp1v1a6zgfq8w6iyyxmsdj4c71bp157nnf58cb8hb";
configureFlags = [
"--with-event-libevent-dir=${pkgs.libevent.dev}"
"--with-event-core"
"--with-event-extra"
"--with-event-pthreads"
];
postPhpize = ''
substituteInPlace configure --replace 'as_fn_error $? "Couldn'\'''t find $phpincludedir/sockets/php_sockets.h. Please check if sockets extension installed" "$LINENO" 5' \
':'
'';
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = with pkgs; [ openssl libevent ];
internalDeps = [ php.packages.exts.sockets ];
meta = with pkgs.lib; {
description = ''
This is an extension to efficiently schedule I/O, time and signal based
events using the best I/O notification mechanism available for specific platform.
'';
license = licenses.php301;
homepage = "https://bitbucket.org/osmanov/pecl-event/";
};
};
igbinary = buildPecl {
version = "3.0.1";
pname = "igbinary";
sha256 = "1w8jmf1qpggdvq0ndfi86n7i7cqgh1s8q6hys2lijvi37rzn0nar";
configureFlags = [ "--enable-igbinary" ];
makeFlags = [ "phpincludedir=$(dev)/include" ];
outputs = [ "out" "dev" ];
};
imagick = buildPecl {
version = "3.4.4";
pname = "imagick";
sha256 = "0xvhaqny1v796ywx83w7jyjyd0nrxkxf34w9zi8qc8aw8qbammcd";
configureFlags = [ "--with-imagick=${pkgs.imagemagick.dev}" ];
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = [ (if isPhp73 then pkgs.pcre2 else pkgs.pcre) ];
};
mailparse = buildPecl {
version = "3.0.3";
pname = "mailparse";
sha256 = "00nk14jbdbln93mx3ag691avc11ff94hkadrcv5pn51c6ihsxbmz";
internalDeps = [ php.packages.exts.mbstring ];
postConfigure = ''
echo "#define HAVE_MBSTRING 1" >> config.h
'';
};
maxminddb = buildPecl rec {
pname = "maxminddb";
version = "1.6.0";
src = pkgs.fetchFromGitHub {
owner = "maxmind";
repo = "MaxMind-DB-Reader-php";
rev = "v${version}";
sha256 = "0sa943ij9pgz55aik93lllb8lh063bvr66ibn77p3y3p41vdiabz";
};
buildInputs = [ pkgs.libmaxminddb ];
sourceRoot = "source/ext";
meta = with pkgs.lib; {
description = "C extension that is a drop-in replacement for MaxMind\\Db\\Reader";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ ajs124 das_j ];
};
};
memcached = buildPecl rec {
version = "3.1.5";
pname = "memcached";
src = fetchgit {
url = "https://github.com/php-memcached-dev/php-memcached";
rev = "v${version}";
sha256 = "01mbh2m3kfbdvih3c8g3g9h4vdd80r0i9g2z8b3lx3mi8mmcj380";
};
internalDeps = [
php.packages.exts.session
] ++ lib.optionals (lib.versionOlder php.version "7.4") [
php.packages.exts.hash ];
configureFlags = [
"--with-zlib-dir=${pkgs.zlib.dev}"
"--with-libmemcached-dir=${pkgs.libmemcached}"
];
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = with pkgs; [ cyrus_sasl zlib ];
};
mongodb = buildPecl {
pname = "mongodb";
version = "1.6.1";
sha256 = "1j1w4n33347j9kwvxwsrix3gvjbiqcn1s5v59pp64s536cci8q0m";
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = with pkgs; [
cyrus_sasl
icu
openssl
snappy
zlib
(if isPhp73 then pcre2 else pcre)
] ++ lib.optional (pkgs.stdenv.isDarwin) pkgs.darwin.apple_sdk.frameworks.Security;
};
oci8 = buildPecl {
version = "2.2.0";
pname = "oci8";
sha256 = "0jhivxj1nkkza4h23z33y7xhffii60d7dr51h1czjk10qywl7pyd";
buildInputs = [ pkgs.oracle-instantclient ];
configureFlags = [ "--with-oci8=shared,instantclient,${pkgs.oracle-instantclient.lib}/lib" ];
postPatch = ''
sed -i -e 's|OCISDKMANINC=`.*$|OCISDKMANINC="${pkgs.oracle-instantclient.dev}/include"|' config.m4
'';
};
pcov = buildPecl {
version = "1.0.6";
pname = "pcov";
sha256 = "1psfwscrc025z8mziq69pcx60k4fbkqa5g2ia8lplb94mmarj0v1";
buildInputs = [ (if isPhp73 then pkgs.pcre2 else pkgs.pcre) ];
};
pcs = buildPecl {
version = "1.3.3";
pname = "pcs";
sha256 = "0d4p1gpl8gkzdiv860qzxfz250ryf0wmjgyc8qcaaqgkdyh5jy5p";
meta.broken = isPhp74; # Build error
};
pdo_oci = buildPecl rec {
inherit (php) src version;
pname = "pdo_oci";
sourceRoot = "php-${version}/ext/pdo_oci";
buildInputs = [ pkgs.oracle-instantclient ];
configureFlags = [ "--with-pdo-oci=instantclient,${pkgs.oracle-instantclient.lib}/lib" ];
internalDeps = [ php.packages.exts.pdo ];
postPatch = ''
sed -i -e 's|OCISDKMANINC=`.*$|OCISDKMANINC="${pkgs.oracle-instantclient.dev}/include"|' config.m4
'';
};
pdo_sqlsrv = buildPecl {
version = "5.8.0";
pname = "pdo_sqlsrv";
sha256 = "0z4vbyd851b4jr6p69l2ylk91iihndsm2qjb429pxcv8g6dqzqll";
internalDeps = [ php.packages.exts.pdo ];
buildInputs = [ pkgs.unixODBC ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
};
php-cs-fixer = mkDerivation rec {
version = "2.16.1";
pname = "php-cs-fixer";
@ -410,21 +149,6 @@ in
};
};
php_excel = buildPecl rec {
version = "1.0.2";
pname = "php_excel";
phpVersion = "php7";
buildInputs = [ pkgs.libxl ];
src = pkgs.fetchurl {
url = "https://github.com/iliaal/php_excel/releases/download/Excel-1.0.2-PHP7/excel-${version}-${phpVersion}.tgz";
sha256 = "0dpvih9gpiyh1ml22zi7hi6kslkilzby00z1p8x248idylldzs2n";
};
configureFlags = [ "--with-excel" "--with-libxl-incdir=${pkgs.libxl}/include_c" "--with-libxl-libdir=${pkgs.libxl}/lib" ];
};
phpcbf = mkDerivation rec {
version = "3.5.3";
pname = "phpcbf";
@ -513,23 +237,6 @@ in
};
};
protobuf = buildPecl {
version = "3.11.2";
pname = "protobuf";
sha256 = "0bhdykdyk58ywqj940zb7jyvrlgdr6hdb4s8kn79fz3p0i79l9hz";
buildInputs = with pkgs; [ (if isPhp73 then pcre2 else pcre) ];
meta = with pkgs.lib; {
description = ''
Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.
'';
license = licenses.bsd3;
homepage = "https://developers.google.com/protocol-buffers/";
};
};
psalm = mkDerivation rec {
version = "3.9.3";
pname = "psalm";
@ -582,6 +289,311 @@ in
maintainers = with maintainers; [ caugner ];
};
};
};
# Extensions are an attribute set meant for for PHP extensions that extend the
# language rather than human interaction.
extensions = {
apcu = buildPecl {
version = "5.1.18";
pname = "apcu";
sha256 = "0ayykd4hfvdzk7qnr5k6yq5scwf6rb2i05xscfv76q5dmkkynvfl";
buildInputs = [ pcre' ];
doCheck = true;
checkTarget = "test";
checkFlagsArray = ["REPORT_EXIT_STATUS=1" "NO_INTERACTION=1"];
makeFlags = [ "phpincludedir=$(dev)/include" ];
outputs = [ "out" "dev" ];
};
apcu_bc = buildPecl {
version = "1.0.5";
pname = "apcu_bc";
sha256 = "0ma00syhk2ps9k9p02jz7rii6x3i2p986il23703zz5npd6y9n20";
buildInputs = [
php.extensions.apcu
pcre'
];
};
ast = buildPecl {
version = "1.0.5";
pname = "ast";
sha256 = "16c5isldm4csjbcvz1qk2mmrhgvh24sxsp6w6f5a37xpa3vciawp";
};
couchbase = buildPecl rec {
version = "2.6.1";
pname = "couchbase";
buildInputs = [
pkgs.libcouchbase
pkgs.zlib
php.extensions.igbinary
php.extensions.pcs
];
src = pkgs.fetchFromGitHub {
owner = "couchbase";
repo = "php-couchbase";
rev = "v${version}";
sha256 = "0jdzgcvab1vpxai23brmmvizjjq2d2dik9aklz6bzspfb512qjd6";
};
configureFlags = [ "--with-couchbase" ];
internalDeps = [ php.extensions.json ];
patches = [
(pkgs.writeText "php-couchbase.patch" ''
--- a/config.m4
+++ b/config.m4
@@ -9,7 +9,7 @@ if test "$PHP_COUCHBASE" != "no"; then
LIBCOUCHBASE_DIR=$PHP_COUCHBASE
else
AC_MSG_CHECKING(for libcouchbase in default path)
- for i in /usr/local /usr; do
+ for i in ${pkgs.libcouchbase}; do
if test -r $i/include/libcouchbase/couchbase.h; then
LIBCOUCHBASE_DIR=$i
AC_MSG_RESULT(found in $i)
@@ -154,6 +154,8 @@ COUCHBASE_FILES=" \
igbinary_inc_path="$phpincludedir"
elif test -f "$phpincludedir/ext/igbinary/igbinary.h"; then
igbinary_inc_path="$phpincludedir"
+ elif test -f "${php.extensions.igbinary.dev}/include/ext/igbinary/igbinary.h"; then
+ igbinary_inc_path="${php.extensions.igbinary.dev}/include"
fi
if test "$igbinary_inc_path" = ""; then
AC_MSG_WARN([Cannot find igbinary.h])
'')
];
meta.broken = isPhp74; # Build error
};
event = buildPecl {
version = "2.5.3";
pname = "event";
sha256 = "12liry5ldvgwp1v1a6zgfq8w6iyyxmsdj4c71bp157nnf58cb8hb";
configureFlags = [
"--with-event-libevent-dir=${pkgs.libevent.dev}"
"--with-event-core"
"--with-event-extra"
"--with-event-pthreads"
];
postPhpize = ''
substituteInPlace configure --replace 'as_fn_error $? "Couldn'\'''t find $phpincludedir/sockets/php_sockets.h. Please check if sockets extension installed" "$LINENO" 5' \
':'
'';
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = with pkgs; [ openssl libevent ];
internalDeps = [ php.extensions.sockets ];
meta = with pkgs.lib; {
description = ''
This is an extension to efficiently schedule I/O, time and signal based
events using the best I/O notification mechanism available for specific platform.
'';
license = licenses.php301;
homepage = "https://bitbucket.org/osmanov/pecl-event/";
};
};
igbinary = buildPecl {
version = "3.0.1";
pname = "igbinary";
sha256 = "1w8jmf1qpggdvq0ndfi86n7i7cqgh1s8q6hys2lijvi37rzn0nar";
configureFlags = [ "--enable-igbinary" ];
makeFlags = [ "phpincludedir=$(dev)/include" ];
outputs = [ "out" "dev" ];
};
imagick = buildPecl {
version = "3.4.4";
pname = "imagick";
sha256 = "0xvhaqny1v796ywx83w7jyjyd0nrxkxf34w9zi8qc8aw8qbammcd";
configureFlags = [ "--with-imagick=${pkgs.imagemagick.dev}" ];
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = [ pcre' ];
};
mailparse = buildPecl {
version = "3.0.3";
pname = "mailparse";
sha256 = "00nk14jbdbln93mx3ag691avc11ff94hkadrcv5pn51c6ihsxbmz";
internalDeps = [ php.extensions.mbstring ];
postConfigure = ''
echo "#define HAVE_MBSTRING 1" >> config.h
'';
};
maxminddb = buildPecl rec {
pname = "maxminddb";
version = "1.6.0";
src = pkgs.fetchFromGitHub {
owner = "maxmind";
repo = "MaxMind-DB-Reader-php";
rev = "v${version}";
sha256 = "0sa943ij9pgz55aik93lllb8lh063bvr66ibn77p3y3p41vdiabz";
};
buildInputs = [ pkgs.libmaxminddb ];
sourceRoot = "source/ext";
meta = with pkgs.lib; {
description = "C extension that is a drop-in replacement for MaxMind\\Db\\Reader";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ ajs124 das_j ];
};
};
memcached = buildPecl rec {
version = "3.1.5";
pname = "memcached";
src = fetchgit {
url = "https://github.com/php-memcached-dev/php-memcached";
rev = "v${version}";
sha256 = "01mbh2m3kfbdvih3c8g3g9h4vdd80r0i9g2z8b3lx3mi8mmcj380";
};
internalDeps = [
php.extensions.session
] ++ lib.optionals (lib.versionOlder php.version "7.4") [
php.extensions.hash
];
configureFlags = [
"--with-zlib-dir=${pkgs.zlib.dev}"
"--with-libmemcached-dir=${pkgs.libmemcached}"
];
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = with pkgs; [ cyrus_sasl zlib ];
};
mongodb = buildPecl {
pname = "mongodb";
version = "1.6.1";
sha256 = "1j1w4n33347j9kwvxwsrix3gvjbiqcn1s5v59pp64s536cci8q0m";
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = with pkgs; [
cyrus_sasl
icu
openssl
snappy
zlib
pcre'
] ++ lib.optional (pkgs.stdenv.isDarwin) pkgs.darwin.apple_sdk.frameworks.Security;
};
oci8 = buildPecl {
version = "2.2.0";
pname = "oci8";
sha256 = "0jhivxj1nkkza4h23z33y7xhffii60d7dr51h1czjk10qywl7pyd";
buildInputs = [ pkgs.oracle-instantclient ];
configureFlags = [ "--with-oci8=shared,instantclient,${pkgs.oracle-instantclient.lib}/lib" ];
postPatch = ''
sed -i -e 's|OCISDKMANINC=`.*$|OCISDKMANINC="${pkgs.oracle-instantclient.dev}/include"|' config.m4
'';
};
pcov = buildPecl {
version = "1.0.6";
pname = "pcov";
sha256 = "1psfwscrc025z8mziq69pcx60k4fbkqa5g2ia8lplb94mmarj0v1";
buildInputs = [ pcre' ];
};
pcs = buildPecl {
version = "1.3.3";
pname = "pcs";
sha256 = "0d4p1gpl8gkzdiv860qzxfz250ryf0wmjgyc8qcaaqgkdyh5jy5p";
meta.broken = isPhp74; # Build error
};
pdo_oci = buildPecl rec {
inherit (php) src version;
pname = "pdo_oci";
sourceRoot = "php-${version}/ext/pdo_oci";
buildInputs = [ pkgs.oracle-instantclient ];
configureFlags = [ "--with-pdo-oci=instantclient,${pkgs.oracle-instantclient.lib}/lib" ];
internalDeps = [ php.extensions.pdo ];
postPatch = ''
sed -i -e 's|OCISDKMANINC=`.*$|OCISDKMANINC="${pkgs.oracle-instantclient.dev}/include"|' config.m4
'';
};
pdo_sqlsrv = buildPecl {
version = "5.8.0";
pname = "pdo_sqlsrv";
sha256 = "0z4vbyd851b4jr6p69l2ylk91iihndsm2qjb429pxcv8g6dqzqll";
internalDeps = [ php.extensions.pdo ];
buildInputs = [ pkgs.unixODBC ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
};
php_excel = buildPecl rec {
version = "1.0.2";
pname = "php_excel";
phpVersion = "php7";
buildInputs = [ pkgs.libxl ];
src = pkgs.fetchurl {
url = "https://github.com/iliaal/php_excel/releases/download/Excel-1.0.2-PHP7/excel-${version}-${phpVersion}.tgz";
sha256 = "0dpvih9gpiyh1ml22zi7hi6kslkilzby00z1p8x248idylldzs2n";
};
configureFlags = [ "--with-excel" "--with-libxl-incdir=${pkgs.libxl}/include_c" "--with-libxl-libdir=${pkgs.libxl}/lib" ];
};
protobuf = buildPecl {
version = "3.11.2";
pname = "protobuf";
sha256 = "0bhdykdyk58ywqj940zb7jyvrlgdr6hdb4s8kn79fz3p0i79l9hz";
buildInputs = with pkgs; [ pcre' ];
meta = with pkgs.lib; {
description = ''
Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.
'';
license = licenses.bsd3;
homepage = "https://developers.google.com/protocol-buffers/";
};
};
redis = buildPecl {
version = "5.1.1";
@ -589,7 +601,7 @@ in
sha256 = "1041zv91fkda73w4c3pj6zdvwjgb3q7mxg6mwnq9gisl80mrs732";
internalDeps = with php.packages.exts; [
internalDeps = with php.extensions; [
json
session
] ++ lib.optionals (lib.versionOlder php.version "7.4") [
@ -666,8 +678,7 @@ in
meta.broken = isPhp73;
};
exts = let
} // (let
# Function to build a single php extension based on the php version.
#
# Name passed is the name of the extension and is automatically used
@ -730,9 +741,7 @@ in
# want to build.
#
# These will be passed as arguments to mkExtension above.
extensionData = let
pcre' = if (lib.versionAtLeast php.version "7.3") then pcre2 else pcre;
in [
extensionData = [
{ name = "bcmath"; }
{ name = "bz2"; buildInputs = [ bzip2 ]; configureFlags = [ "--with-bz2=${bzip2.dev}" ]; }
{ name = "calendar"; }
@ -814,7 +823,7 @@ in
doCheck = false; }
{ name = "mbstring"; buildInputs = [ oniguruma ]; doCheck = false; }
{ name = "mysqli";
internalDeps = [ php.packages.exts.mysqlnd ];
internalDeps = [ php.extensions.mysqlnd ];
configureFlags = [ "--with-mysqli=mysqlnd" "--with-mysql-sock=/run/mysqld/mysqld.sock" ];
doCheck = false; }
{ name = "mysqlnd";
@ -875,27 +884,27 @@ in
{ name = "pcntl"; }
{ name = "pdo"; doCheck = false; }
{ name = "pdo_dblib";
internalDeps = [ php.packages.exts.pdo ];
internalDeps = [ php.extensions.pdo ];
configureFlags = [ "--with-pdo-dblib=${freetds}" ];
# Doesn't seem to work on darwin.
enable = (!stdenv.isDarwin);
doCheck = false; }
# pdo_firebird (7.4, 7.3, 7.2)
{ name = "pdo_mysql";
internalDeps = with php.packages.exts; [ pdo mysqlnd ];
internalDeps = with php.extensions; [ pdo mysqlnd ];
configureFlags = [ "--with-pdo-mysql=mysqlnd" ];
doCheck = false; }
# pdo_oci (7.4, 7.3, 7.2)
{ name = "pdo_odbc";
internalDeps = [ php.packages.exts.pdo ];
internalDeps = [ php.extensions.pdo ];
configureFlags = [ "--with-pdo-odbc=unixODBC,${unixODBC}" ];
doCheck = false; }
{ name = "pdo_pgsql";
internalDeps = [ php.packages.exts.pdo ];
internalDeps = [ php.extensions.pdo ];
configureFlags = [ "--with-pdo-pgsql=${postgresql}" ];
doCheck = false; }
{ name = "pdo_sqlite";
internalDeps = [ php.packages.exts.pdo ];
internalDeps = [ php.extensions.pdo ];
buildInputs = [ sqlite ];
configureFlags = [ "--with-pdo-sqlite=${sqlite.dev}" ];
doCheck = false; }
@ -999,5 +1008,5 @@ in
}) (builtins.filter (i: i.enable or true) extensionData);
# Produce the final attribute set of all extensions defined.
in builtins.listToAttrs namedExtensions;
in builtins.listToAttrs namedExtensions);
}