From 22bf2d03315ea19bed47bc610b4b83df31e47f7b Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 24 Feb 2021 08:25:52 +0100 Subject: [PATCH] top-level/php-packages: fix types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passing list to `optional` wraps it in another list but we just want to return it as is. Let’s just use `optionals` everywhere as that is much more predictable and makes such mistakes obvious. --- pkgs/top-level/php-packages.nix | 38 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 3df697d3d56..611a3afca36 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -268,7 +268,7 @@ lib.makeScope pkgs.newScope (self: with self; { buildInputs = [ libxml2 ]; configureFlags = [ "--enable-dom" ] # Required to build on darwin. - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } { name = "enchant"; buildInputs = [ enchant1 ]; configureFlags = [ "--with-enchant=${enchant1}" ]; @@ -331,10 +331,12 @@ lib.makeScope pkgs.newScope (self: with self; { # interbase (7.3, 7.2) { name = "intl"; buildInputs = [ icu64 ]; - patches = lib.optional (lib.versionOlder php.version "7.4") (fetchpatch { - url = "https://github.com/php/php-src/commit/93a9b56c90c334896e977721bfb3f38b1721cec6.patch"; - sha256 = "055l40lpyhb0rbjn6y23qkzdhvpp7inbnn6x13cpn4inmhjqfpg4"; - }); + patches = lib.optionals (lib.versionOlder php.version "7.4") [ + (fetchpatch { + url = "https://github.com/php/php-src/commit/93a9b56c90c334896e977721bfb3f38b1721cec6.patch"; + sha256 = "055l40lpyhb0rbjn6y23qkzdhvpp7inbnn6x13cpn4inmhjqfpg4"; + }) + ]; } { name = "json"; enable = lib.versionOlder php.version "8.0"; } { name = "ldap"; @@ -344,7 +346,9 @@ lib.makeScope pkgs.newScope (self: with self; { "LDAP_DIR=${openldap.dev}" "LDAP_INCDIR=${openldap.dev}/include" "LDAP_LIBDIR=${openldap.out}/lib" - ] ++ lib.optional stdenv.isLinux "--with-ldap-sasl=${cyrus_sasl.dev}"; + ] ++ lib.optionals stdenv.isLinux [ + "--with-ldap-sasl=${cyrus_sasl.dev}" + ]; doCheck = false; } { name = "mbstring"; buildInputs = [ oniguruma ] ++ lib.optionals (lib.versionAtLeast php.version "8.0") [ pcre' @@ -374,7 +378,7 @@ lib.makeScope pkgs.newScope (self: with self; { +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | '') - ] ++ lib.optional (lib.versionOlder php.version "7.4.8") [ + ] ++ lib.optionals (lib.versionOlder php.version "7.4.8") [ (pkgs.writeText "mysqlnd_fix_compression.patch" '' --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -398,7 +402,7 @@ lib.makeScope pkgs.newScope (self: with self; { buildInputs = [ pcre' ] ++ lib.optionals (lib.versionAtLeast php.version "8.0") [ valgrind.dev ]; - patches = [] ++ lib.optional (lib.versionOlder php.version "7.4") [ + patches = [] ++ lib.optionals (lib.versionOlder php.version "7.4") [ (pkgs.writeText "zend_file_cache_config.patch" '' --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -468,7 +472,7 @@ lib.makeScope pkgs.newScope (self: with self; { buildInputs = [ libxml2 pcre' ]; configureFlags = [ "--enable-simplexml" ] # Required to build on darwin. - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } { name = "snmp"; buildInputs = [ net-snmp openssl ]; configureFlags = [ "--with-snmp" ]; @@ -479,7 +483,7 @@ lib.makeScope pkgs.newScope (self: with self; { buildInputs = [ libxml2 ]; configureFlags = [ "--enable-soap" ] # Required to build on darwin. - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; doCheck = false; } { name = "sockets"; doCheck = false; } { name = "sodium"; buildInputs = [ libsodium ]; } @@ -499,7 +503,7 @@ lib.makeScope pkgs.newScope (self: with self; { buildInputs = [ libxml2 ]; configureFlags = [ "--enable-xml" ] # Required to build on darwin. - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; doCheck = false; } { name = "xmlreader"; buildInputs = [ libxml2 ]; @@ -507,19 +511,19 @@ lib.makeScope pkgs.newScope (self: with self; { NIX_CFLAGS_COMPILE = [ "-I../.." "-DHAVE_DOM" ]; configureFlags = [ "--enable-xmlreader" ] # Required to build on darwin. - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } { name = "xmlrpc"; buildInputs = [ libxml2 libiconv ]; # xmlrpc was unbundled in 8.0 https://php.watch/versions/8.0/xmlrpc enable = lib.versionOlder php.version "8.0"; configureFlags = [ "--with-xmlrpc" ] # Required to build on darwin. - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } { name = "xmlwriter"; buildInputs = [ libxml2 ]; configureFlags = [ "--enable-xmlwriter" ] # Required to build on darwin. - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } { name = "xsl"; buildInputs = [ libxslt libxml2 ]; doCheck = lib.versionOlder php.version "8.0"; @@ -528,8 +532,8 @@ lib.makeScope pkgs.newScope (self: with self; { { name = "zip"; buildInputs = [ libzip pcre' ]; configureFlags = [ "--with-zip" ] - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ] - ++ lib.optional (lib.versionOlder php.version "7.3") [ "--with-libzip" ]; + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ] + ++ lib.optionals (lib.versionOlder php.version "7.3") [ "--with-libzip" ]; doCheck = false; } { name = "zlib"; buildInputs = [ zlib ]; @@ -538,7 +542,7 @@ lib.makeScope pkgs.newScope (self: with self; { ../development/interpreters/php/zlib-darwin-tests.patch ]; configureFlags = [ "--with-zlib" ] - ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ]; } + ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ]; } ]; # Convert the list of attrs: