summary refs log tree commit diff
path: root/nixos/tests/web-servers/unit-php.nix
diff options
context:
space:
mode:
authorElis Hirwing <elis@hirwing.se>2021-06-03 19:17:27 +0200
committerElis Hirwing <elis@hirwing.se>2021-06-04 09:27:07 +0200
commitc76bebc549f2bd81bf5c70617d3d564a1ae6e8d1 (patch)
tree23c129e3fbcb975746da049c10cf6c79015ed1d7 /nixos/tests/web-servers/unit-php.nix
parentfb644190a0523d473129e3a86599ec50c2bafe77 (diff)
downloadnixpkgs-c76bebc549f2bd81bf5c70617d3d564a1ae6e8d1.tar
nixpkgs-c76bebc549f2bd81bf5c70617d3d564a1ae6e8d1.tar.gz
nixpkgs-c76bebc549f2bd81bf5c70617d3d564a1ae6e8d1.tar.bz2
nixpkgs-c76bebc549f2bd81bf5c70617d3d564a1ae6e8d1.tar.lz
nixpkgs-c76bebc549f2bd81bf5c70617d3d564a1ae6e8d1.tar.xz
nixpkgs-c76bebc549f2bd81bf5c70617d3d564a1ae6e8d1.tar.zst
nixpkgs-c76bebc549f2bd81bf5c70617d3d564a1ae6e8d1.zip
unit: Add php80 and use it as default
Diffstat (limited to 'nixos/tests/web-servers/unit-php.nix')
-rw-r--r--nixos/tests/web-servers/unit-php.nix46
1 files changed, 18 insertions, 28 deletions
diff --git a/nixos/tests/web-servers/unit-php.nix b/nixos/tests/web-servers/unit-php.nix
index c4e89f069f1..00512b506cc 100644
--- a/nixos/tests/web-servers/unit-php.nix
+++ b/nixos/tests/web-servers/unit-php.nix
@@ -1,6 +1,6 @@
 import ../make-test-python.nix ({pkgs, ...}:
- let
-    testdir = pkgs.writeTextDir "www/info.php" "<?php phpinfo();";
+let
+  testdir = pkgs.writeTextDir "www/info.php" "<?php phpinfo();";
 
 in {
   name = "unit-php-test";
@@ -9,37 +9,27 @@ in {
   machine = { config, lib, pkgs, ... }: {
     services.unit = {
       enable = true;
-      config = ''
-        {
-          "listeners": {
-            "*:9074": {
-              "application": "php_74"
-            }
-          },
-          "applications": {
-            "php_74": {
-              "type": "php 7.4",
-              "processes": 1,
-              "user": "testuser",
-              "group": "testgroup",
-              "root": "${testdir}/www",
-              "index": "info.php",
-              "options": {
-                "file": "${pkgs.unit.usedPhp74}/lib/php.ini"
-              }
-            }
-          }
-        }
-      '';
+      config = pkgs.lib.strings.toJSON {
+        listeners."*:9080".application = "php_80";
+        applications.php_80 = {
+          type = "php 8.0";
+          processes = 1;
+          user = "testuser";
+          group = "testgroup";
+          root = "${testdir}/www";
+          index = "info.php";
+          options.file = "${pkgs.unit.usedPhp80}/lib/php.ini";
+        };
+      };
     };
     users = {
       users.testuser = {
         isSystemUser = true;
-        uid = 1074;
+        uid = 1080;
         group = "testgroup";
       };
       groups.testgroup = {
-        gid= 1074;
+        gid = 1080;
       };
     };
   };
@@ -47,8 +37,8 @@ in {
     machine.wait_for_unit("unit.service")
 
     # Check so we get an evaluated PHP back
-    response = machine.succeed("curl -f -vvv -s http://127.0.0.1:9074/")
-    assert "PHP Version ${pkgs.unit.usedPhp74.version}" in response, "PHP version not detected"
+    response = machine.succeed("curl -f -vvv -s http://127.0.0.1:9080/")
+    assert "PHP Version ${pkgs.unit.usedPhp80.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"]: