unit: Add php80 and use it as default
This commit is contained in:
parent
fb644190a0
commit
c76bebc549
|
@ -1,5 +1,5 @@
|
||||||
import ../make-test-python.nix ({pkgs, ...}:
|
import ../make-test-python.nix ({pkgs, ...}:
|
||||||
let
|
let
|
||||||
testdir = pkgs.writeTextDir "www/info.php" "<?php phpinfo();";
|
testdir = pkgs.writeTextDir "www/info.php" "<?php phpinfo();";
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
@ -9,37 +9,27 @@ in {
|
||||||
machine = { config, lib, pkgs, ... }: {
|
machine = { config, lib, pkgs, ... }: {
|
||||||
services.unit = {
|
services.unit = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = ''
|
config = pkgs.lib.strings.toJSON {
|
||||||
{
|
listeners."*:9080".application = "php_80";
|
||||||
"listeners": {
|
applications.php_80 = {
|
||||||
"*:9074": {
|
type = "php 8.0";
|
||||||
"application": "php_74"
|
processes = 1;
|
||||||
}
|
user = "testuser";
|
||||||
},
|
group = "testgroup";
|
||||||
"applications": {
|
root = "${testdir}/www";
|
||||||
"php_74": {
|
index = "info.php";
|
||||||
"type": "php 7.4",
|
options.file = "${pkgs.unit.usedPhp80}/lib/php.ini";
|
||||||
"processes": 1,
|
};
|
||||||
"user": "testuser",
|
};
|
||||||
"group": "testgroup",
|
|
||||||
"root": "${testdir}/www",
|
|
||||||
"index": "info.php",
|
|
||||||
"options": {
|
|
||||||
"file": "${pkgs.unit.usedPhp74}/lib/php.ini"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
users = {
|
users = {
|
||||||
users.testuser = {
|
users.testuser = {
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
uid = 1074;
|
uid = 1080;
|
||||||
group = "testgroup";
|
group = "testgroup";
|
||||||
};
|
};
|
||||||
groups.testgroup = {
|
groups.testgroup = {
|
||||||
gid= 1074;
|
gid = 1080;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -47,8 +37,8 @@ in {
|
||||||
machine.wait_for_unit("unit.service")
|
machine.wait_for_unit("unit.service")
|
||||||
|
|
||||||
# Check so we get an evaluated PHP back
|
# Check so we get an evaluated PHP back
|
||||||
response = machine.succeed("curl -f -vvv -s http://127.0.0.1:9074/")
|
response = machine.succeed("curl -f -vvv -s http://127.0.0.1:9080/")
|
||||||
assert "PHP Version ${pkgs.unit.usedPhp74.version}" in response, "PHP version not detected"
|
assert "PHP Version ${pkgs.unit.usedPhp80.version}" in response, "PHP version not detected"
|
||||||
|
|
||||||
# Check so we have database and some other extensions loaded
|
# 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"]:
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
, pcre2
|
, pcre2
|
||||||
, withPython2 ? false, python2
|
, withPython2 ? false, python2
|
||||||
, withPython3 ? true, python3, ncurses
|
, withPython3 ? true, python3, ncurses
|
||||||
, withPHP74 ? true, php74
|
, withPHP74 ? false, php74
|
||||||
|
, withPHP80 ? true, php80
|
||||||
, withPerl530 ? false, perl530
|
, withPerl530 ? false, perl530
|
||||||
, withPerl532 ? true, perl532
|
, withPerl532 ? true, perl532
|
||||||
, withPerldevel ? false, perldevel
|
, withPerldevel ? false, perldevel
|
||||||
|
@ -26,6 +27,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
php74-unit = php74.override phpConfig;
|
php74-unit = php74.override phpConfig;
|
||||||
|
php80-unit = php80.override phpConfig;
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
version = "1.24.0";
|
version = "1.24.0";
|
||||||
|
@ -44,6 +46,7 @@ in stdenv.mkDerivation rec {
|
||||||
++ optional withPython2 python2
|
++ optional withPython2 python2
|
||||||
++ optionals withPython3 [ python3 ncurses ]
|
++ optionals withPython3 [ python3 ncurses ]
|
||||||
++ optional withPHP74 php74-unit
|
++ optional withPHP74 php74-unit
|
||||||
|
++ optional withPHP80 php80-unit
|
||||||
++ optional withPerl530 perl530
|
++ optional withPerl530 perl530
|
||||||
++ optional withPerl532 perl532
|
++ optional withPerl532 perl532
|
||||||
++ optional withPerldevel perldevel
|
++ optional withPerldevel perldevel
|
||||||
|
@ -62,11 +65,13 @@ in stdenv.mkDerivation rec {
|
||||||
|
|
||||||
# Optionally add the PHP derivations used so they can be addressed in the configs
|
# Optionally add the PHP derivations used so they can be addressed in the configs
|
||||||
usedPhp74 = optionals withPHP74 php74-unit;
|
usedPhp74 = optionals withPHP74 php74-unit;
|
||||||
|
usedPhp80 = optionals withPHP80 php80-unit;
|
||||||
|
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
${optionalString withPython2 "./configure python --module=python2 --config=python2-config --lib-path=${python2}/lib"}
|
${optionalString withPython2 "./configure python --module=python2 --config=python2-config --lib-path=${python2}/lib"}
|
||||||
${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"}
|
${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"}
|
||||||
${optionalString withPHP74 "./configure php --module=php74 --config=${php74-unit.unwrapped.dev}/bin/php-config --lib-path=${php74-unit}/lib"}
|
${optionalString withPHP74 "./configure php --module=php74 --config=${php74-unit.unwrapped.dev}/bin/php-config --lib-path=${php74-unit}/lib"}
|
||||||
|
${optionalString withPHP80 "./configure php --module=php80 --config=${php80-unit.unwrapped.dev}/bin/php-config --lib-path=${php80-unit}/lib"}
|
||||||
${optionalString withPerl530 "./configure perl --module=perl530 --perl=${perl530}/bin/perl"}
|
${optionalString withPerl530 "./configure perl --module=perl530 --perl=${perl530}/bin/perl"}
|
||||||
${optionalString withPerl532 "./configure perl --module=perl532 --perl=${perl532}/bin/perl"}
|
${optionalString withPerl532 "./configure perl --module=perl532 --perl=${perl532}/bin/perl"}
|
||||||
${optionalString withPerldevel "./configure perl --module=perldev --perl=${perldevel}/bin/perl"}
|
${optionalString withPerldevel "./configure perl --module=perldev --perl=${perldevel}/bin/perl"}
|
||||||
|
|
Loading…
Reference in a new issue