tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
unit: add php 8.1
Izorkin
3 years ago
2d7c97f4
66b6475a
+17
-7
2 changed files
expand all
collapse all
unified
split
nixos
tests
web-servers
unit-php.nix
pkgs
servers
http
unit
default.nix
+11
-6
nixos/tests/web-servers/unit-php.nix
···
10
10
services.unit = {
11
11
enable = true;
12
12
config = pkgs.lib.strings.toJSON {
13
13
-
listeners."*:9080".application = "php_80";
14
14
-
applications.php_80 = {
15
15
-
type = "php 8.0";
13
13
+
listeners."*:9081".application = "php_81";
14
14
+
applications.php_81 = {
15
15
+
type = "php 8.1";
16
16
processes = 1;
17
17
user = "testuser";
18
18
group = "testgroup";
19
19
root = "${testdir}/www";
20
20
index = "info.php";
21
21
-
options.file = "${pkgs.unit.usedPhp80}/lib/php.ini";
21
21
+
options.file = "${pkgs.unit.usedPhp81}/lib/php.ini";
22
22
};
23
23
};
24
24
};
···
34
34
};
35
35
};
36
36
testScript = ''
37
37
+
machine.start()
38
38
+
37
39
machine.wait_for_unit("unit.service")
40
40
+
machine.wait_for_open_port(9081)
38
41
39
42
# Check so we get an evaluated PHP back
40
40
-
response = machine.succeed("curl -f -vvv -s http://127.0.0.1:9080/")
41
41
-
assert "PHP Version ${pkgs.unit.usedPhp80.version}" in response, "PHP version not detected"
43
43
+
response = machine.succeed("curl -f -vvv -s http://127.0.0.1:9081/")
44
44
+
assert "PHP Version ${pkgs.unit.usedPhp81.version}" in response, "PHP version not detected"
42
45
43
46
# Check so we have database and some other extensions loaded
44
47
for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite"]:
45
48
assert ext in response, f"Missing {ext} extension"
49
49
+
50
50
+
machine.shutdown()
46
51
'';
47
52
})
+6
-1
pkgs/servers/http/unit/default.nix
···
1
1
{ lib, stdenv, fetchFromGitHub, nixosTests, which
2
2
, pcre2
3
3
, withPython3 ? true, python3, ncurses
4
4
-
, withPHP80 ? true, php80
4
4
+
, withPHP80 ? false, php80
5
5
+
, withPHP81 ? true, php81
5
6
, withPerl532 ? false, perl532
6
7
, withPerl534 ? true, perl534
7
8
, withPerldevel ? false, perldevel
···
24
25
};
25
26
26
27
php80-unit = php80.override phpConfig;
28
28
+
php81-unit = php81.override phpConfig;
27
29
28
30
in stdenv.mkDerivation rec {
29
31
version = "1.27.0";
···
41
43
buildInputs = [ pcre2.dev ]
42
44
++ optionals withPython3 [ python3 ncurses ]
43
45
++ optional withPHP80 php80-unit
46
46
+
++ optional withPHP81 php81-unit
44
47
++ optional withPerl532 perl532
45
48
++ optional withPerl534 perl534
46
49
++ optional withPerldevel perldevel
···
58
61
59
62
# Optionally add the PHP derivations used so they can be addressed in the configs
60
63
usedPhp80 = optionals withPHP80 php80-unit;
64
64
+
usedPhp81 = optionals withPHP81 php81-unit;
61
65
62
66
postConfigure = ''
63
67
${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"}
64
68
${optionalString withPHP80 "./configure php --module=php80 --config=${php80-unit.unwrapped.dev}/bin/php-config --lib-path=${php80-unit}/lib"}
69
69
+
${optionalString withPHP81 "./configure php --module=php81 --config=${php81-unit.unwrapped.dev}/bin/php-config --lib-path=${php81-unit}/lib"}
65
70
${optionalString withPerl532 "./configure perl --module=perl532 --perl=${perl532}/bin/perl"}
66
71
${optionalString withPerl534 "./configure perl --module=perl534 --perl=${perl534}/bin/perl"}
67
72
${optionalString withPerldevel "./configure perl --module=perldev --perl=${perldevel}/bin/perl"}