From 4ff523f691c2caf9e878b6f3ec1b6f14513bd226 Mon Sep 17 00:00:00 2001 From: talyz Date: Fri, 3 Apr 2020 18:14:26 +0200 Subject: [PATCH] php: Simplify php-packages import, rename exts -> extensions --- nixos/doc/manual/release-notes/rl-2009.xml | 2 +- nixos/modules/services/web-apps/nextcloud.nix | 2 +- pkgs/development/interpreters/php/default.nix | 33 +++++++++---------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index 1618fc89477f..14ac73b457d8 100644 --- a/nixos/doc/manual/release-notes/rl-2009.xml +++ b/nixos/doc/manual/release-notes/rl-2009.xml @@ -134,7 +134,7 @@ environment.systemPackages = [ -(pkgs.php.buildEnv { exts = pp: with pp; [ +(pkgs.php.buildEnv { extensions = pp: with pp; [ imagick opcache pdo_mysql diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix index 33d356700294..82783a2b6aa4 100644 --- a/nixos/modules/services/web-apps/nextcloud.nix +++ b/nixos/modules/services/web-apps/nextcloud.nix @@ -7,7 +7,7 @@ let fpm = config.services.phpfpm.pools.nextcloud; phpPackage = pkgs.php74.buildEnv { - exts = pp: with pp; [ + extensions = e: with e; [ 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 diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix index 99a859cb5742..2558cf2c4b5d 100644 --- a/pkgs/development/interpreters/php/default.nix +++ b/pkgs/development/interpreters/php/default.nix @@ -150,27 +150,22 @@ let let php = generic (builtins.removeAttrs args [ "self" "selfWithExtensions" ]); - packages = (callPackage ../../../top-level/php-packages.nix { + php-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 ? "" }: + buildEnv = { extensions ? (_: []), extraConfig ? "" }: let getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name; - extList = exts extensions; + extList = extensions php-packages.extensions; - # Generate extension load configuration snippets from - # exts. 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. + # 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: @@ -198,7 +193,8 @@ let inherit (php) dev; nativeBuildInputs = [ makeWrapper ]; passthru = { - inherit buildEnv packages extensions; + inherit buildEnv; + inherit (php-packages) packages extensions; }; paths = [ php ]; postBuild = '' @@ -214,7 +210,8 @@ let in php.overrideAttrs (_: { passthru = { - inherit buildEnv packages extensions; + inherit buildEnv; + inherit (php-packages) packages extensions; }; }); @@ -246,7 +243,7 @@ let }; defaultPhpExtensions = { - exts = pp: with pp; ([ + extensions = 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