summary refs log tree commit diff
diff options
context:
space:
mode:
authorElis Hirwing <elis@hirwing.se>2020-05-30 18:52:41 +0200
committerElis Hirwing <elis@hirwing.se>2020-05-30 18:52:41 +0200
commita4bf2cc1666079b0d1d46cb059fe263bd56fd6ec (patch)
treec939700583afb98d0172bd75960d4cfbf5869050
parentf75d62941d8ad616bfc334ae19d71a0a6677dd19 (diff)
downloadnixpkgs-a4bf2cc1666079b0d1d46cb059fe263bd56fd6ec.tar
nixpkgs-a4bf2cc1666079b0d1d46cb059fe263bd56fd6ec.tar.gz
nixpkgs-a4bf2cc1666079b0d1d46cb059fe263bd56fd6ec.tar.bz2
nixpkgs-a4bf2cc1666079b0d1d46cb059fe263bd56fd6ec.tar.lz
nixpkgs-a4bf2cc1666079b0d1d46cb059fe263bd56fd6ec.tar.xz
nixpkgs-a4bf2cc1666079b0d1d46cb059fe263bd56fd6ec.tar.zst
nixpkgs-a4bf2cc1666079b0d1d46cb059fe263bd56fd6ec.zip
unit: Expose PHP expressions used so it can easily be accessed for configs
-rw-r--r--nixos/tests/web-servers/unit-php.nix14
-rw-r--r--pkgs/servers/http/unit/default.nix7
2 files changed, 18 insertions, 3 deletions
diff --git a/nixos/tests/web-servers/unit-php.nix b/nixos/tests/web-servers/unit-php.nix
index c6327a1f825..2a0a5bdaa5d 100644
--- a/nixos/tests/web-servers/unit-php.nix
+++ b/nixos/tests/web-servers/unit-php.nix
@@ -23,7 +23,10 @@ in {
               "user": "testuser",
               "group": "testgroup",
               "root": "${testdir}/www",
-              "index": "info.php"
+              "index": "info.php",
+              "options": {
+                "file": "${pkgs.unit.usedPhp74}/lib/php.ini"
+              }
             }
           }
         }
@@ -42,6 +45,13 @@ in {
   };
   testScript = ''
     machine.wait_for_unit("unit.service")
-    assert "PHP Version ${pkgs.php74.version}" in machine.succeed("curl -vvv -s http://127.0.0.1:9074/")
+
+    # Check so we get an evaluated PHP back
+    response = machine.succeed("curl -vvv -s http://127.0.0.1:9074/")
+    assert "PHP Version ${pkgs.unit.usedPhp74.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"]:
+        assert ext in response, f"Missing {ext} extension"
   '';
 })
diff --git a/pkgs/servers/http/unit/default.nix b/pkgs/servers/http/unit/default.nix
index c161566d329..1d5f28834f2 100644
--- a/pkgs/servers/http/unit/default.nix
+++ b/pkgs/servers/http/unit/default.nix
@@ -49,7 +49,7 @@ in stdenv.mkDerivation rec {
     ++ optionals withPython3 [ python3 ncurses ]
     ++ optional withPHP72 php72-unit
     ++ optional withPHP73 php73-unit
-    ++ optional withPHP73 php74-unit
+    ++ optional withPHP74 php74-unit
     ++ optional withPerl528 perl528
     ++ optional withPerl530 perl530
     ++ optional withPerldevel perldevel
@@ -67,6 +67,11 @@ in stdenv.mkDerivation rec {
     ++ optional (!withIPv6) "--no-ipv6"
     ++ optional withDebug   "--debug";
 
+  # Optionally add the PHP derivations used so they can be addressed in the configs
+  usedPhp72 = optionals withPHP72 php72-unit;
+  usedPhp73 = optionals withPHP73 php73-unit;
+  usedPhp74 = optionals withPHP74 php74-unit;
+
   postConfigure = ''
     ${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"}