From 8c26eaa144897e9031093e9f56cc15c86f259772 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 4 Mar 2021 15:26:36 +0100 Subject: [PATCH 1/3] Revert "php: Add php package versions to extensions/packages pnames" This reverts commit a081dcf86de4f100efe604a52b32df4b14892f44. --- pkgs/build-support/build-pecl.nix | 4 ++-- pkgs/top-level/php-packages.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/build-pecl.nix b/pkgs/build-support/build-pecl.nix index bc905ee84a0..d75d3cf943a 100644 --- a/pkgs/build-support/build-pecl.nix +++ b/pkgs/build-support/build-pecl.nix @@ -16,10 +16,10 @@ }@args: stdenv.mkDerivation (args // { - pname = "php-${php.version}-${pname}"; + name = "php-${pname}-${version}"; extensionName = pname; - inherit version src; + inherit src; nativeBuildInputs = [ autoreconfHook re2c ] ++ nativeBuildInputs; buildInputs = [ php ] ++ peclDeps ++ buildInputs; diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 3c8738565f6..c9c4414f2fb 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -16,7 +16,7 @@ lib.makeScope pkgs.newScope (self: with self; { # Wrap mkDerivation to prepend pname with "php-" to make names consistent # with how buildPecl does it and make the file easier to overview. mkDerivation = { pname, ... }@args: pkgs.stdenv.mkDerivation (args // { - pname = "php-${php.version}-${pname}"; + pname = "php-${pname}"; }); pcre' = if (lib.versionAtLeast php.version "7.3") then pcre2 else pcre; From 70ac808b39cecd4bcb67736d3befebc53ae9ca2a Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 4 Mar 2021 15:48:30 +0100 Subject: [PATCH 2/3] nixos/tests/php/fpm: make sure that extensions are actually loaded The phpinfo output from 127.0.0.1:80 only shows configuration options and thus leads to false-positives. --- nixos/tests/php/fpm.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/tests/php/fpm.nix b/nixos/tests/php/fpm.nix index 02ea5179474..3550116a201 100644 --- a/nixos/tests/php/fpm.nix +++ b/nixos/tests/php/fpm.nix @@ -3,6 +3,8 @@ import ../make-test-python.nix ({pkgs, lib, php, ...}: { meta.maintainers = lib.teams.php.members; machine = { config, lib, pkgs, ... }: { + environment.systemPackages = [ php ]; + services.nginx = { enable = true; @@ -50,5 +52,6 @@ import ../make-test-python.nix ({pkgs, lib, php, ...}: { # Check so we have database and some other extensions loaded for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite"]: assert ext in response, f"Missing {ext} extension" + machine.succeed(f'test -n "$(php -m | grep -i {ext})"') ''; }) From 5e5f482f32ea399128893a359fec1a451f62b443 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 4 Mar 2021 16:06:37 +0100 Subject: [PATCH 3/3] nixos/tests/php: add apcu to php to actually test whether extensions are properly loaded --- nixos/tests/php/default.nix | 14 ++++++++++---- nixos/tests/php/fpm.nix | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/nixos/tests/php/default.nix b/nixos/tests/php/default.nix index 6ecaed24604..cf78c9db53b 100644 --- a/nixos/tests/php/default.nix +++ b/nixos/tests/php/default.nix @@ -2,8 +2,14 @@ , config ? {} , pkgs ? import ../../.. { inherit system config; } , php ? pkgs.php -}: { - fpm = import ./fpm.nix { inherit system pkgs php; }; - httpd = import ./httpd.nix { inherit system pkgs php; }; - pcre = import ./pcre.nix { inherit system pkgs php; }; +}: + +let + php' = php.buildEnv { + extensions = { enabled, all }: with all; enabled ++ [ apcu ]; + }; +in { + fpm = import ./fpm.nix { inherit system pkgs; php = php'; }; + httpd = import ./httpd.nix { inherit system pkgs; php = php'; }; + pcre = import ./pcre.nix { inherit system pkgs; php = php'; }; } diff --git a/nixos/tests/php/fpm.nix b/nixos/tests/php/fpm.nix index 3550116a201..b11f85d39cb 100644 --- a/nixos/tests/php/fpm.nix +++ b/nixos/tests/php/fpm.nix @@ -50,7 +50,7 @@ import ../make-test-python.nix ({pkgs, lib, php, ...}: { assert "PHP Version ${php.version}" in response, "PHP version not detected" # Check so we have database and some other extensions loaded - for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite"]: + for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite", "apcu"]: assert ext in response, f"Missing {ext} extension" machine.succeed(f'test -n "$(php -m | grep -i {ext})"') '';