diff --git a/nixos/tests/web-servers/unit-php.nix b/nixos/tests/web-servers/unit-php.nix index 5bef7fab3eff..f0df371945e5 100644 --- a/nixos/tests/web-servers/unit-php.nix +++ b/nixos/tests/web-servers/unit-php.nix @@ -10,15 +10,15 @@ in { services.unit = { enable = true; config = pkgs.lib.strings.toJSON { - listeners."*:9080".application = "php_80"; - applications.php_80 = { - type = "php 8.0"; + listeners."*:9081".application = "php_81"; + applications.php_81 = { + type = "php 8.1"; processes = 1; user = "testuser"; group = "testgroup"; root = "${testdir}/www"; index = "info.php"; - options.file = "${pkgs.unit.usedPhp80}/lib/php.ini"; + options.file = "${pkgs.unit.usedPhp81}/lib/php.ini"; }; }; }; @@ -34,14 +34,19 @@ in { }; }; testScript = '' + machine.start() + machine.wait_for_unit("unit.service") + machine.wait_for_open_port(9081) # Check so we get an evaluated PHP back - 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" + response = machine.succeed("curl -f -vvv -s http://127.0.0.1:9081/") + assert "PHP Version ${pkgs.unit.usedPhp81.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" + + machine.shutdown() ''; }) diff --git a/pkgs/servers/http/unit/default.nix b/pkgs/servers/http/unit/default.nix index 43617f405760..3483623db2e3 100644 --- a/pkgs/servers/http/unit/default.nix +++ b/pkgs/servers/http/unit/default.nix @@ -1,11 +1,14 @@ { lib, stdenv, fetchFromGitHub, nixosTests, which , pcre2 , withPython3 ? true, python3, ncurses -, withPHP80 ? true, php80 +, withPHP80 ? false, php80 +, withPHP81 ? true, php81 , withPerl532 ? false, perl532 , withPerl534 ? true, perl534 , withPerldevel ? false, perldevel -, withRuby_2_7 ? false, ruby_2_7 +, withRuby_2_7 ? true, ruby_2_7 +, withRuby_3_0 ? false, ruby_3_0 +, withRuby_3_1 ? false, ruby_3_1 , withSSL ? true, openssl ? null , withIPv6 ? true , withDebug ? false @@ -24,16 +27,17 @@ let }; php80-unit = php80.override phpConfig; + php81-unit = php81.override phpConfig; in stdenv.mkDerivation rec { - version = "1.26.1"; + version = "1.27.0"; pname = "unit"; src = fetchFromGitHub { owner = "nginx"; repo = pname; rev = version; - sha256 = "sha256-rTT7EJSHepGOwNXVqlOBOhZayZQXyNo3B2Oa1oLf2FI="; + sha256 = "sha256-H/WIrCyocEO/HZfVMyI9IwD565JsUIzC8n1qUYmCvWc="; }; nativeBuildInputs = [ which ]; @@ -41,10 +45,13 @@ in stdenv.mkDerivation rec { buildInputs = [ pcre2.dev ] ++ optionals withPython3 [ python3 ncurses ] ++ optional withPHP80 php80-unit + ++ optional withPHP81 php81-unit ++ optional withPerl532 perl532 ++ optional withPerl534 perl534 ++ optional withPerldevel perldevel ++ optional withRuby_2_7 ruby_2_7 + ++ optional withRuby_3_0 ruby_3_0 + ++ optional withRuby_3_1 ruby_3_1 ++ optional withSSL openssl; configureFlags = [ @@ -58,14 +65,22 @@ in stdenv.mkDerivation rec { # Optionally add the PHP derivations used so they can be addressed in the configs usedPhp80 = optionals withPHP80 php80-unit; + usedPhp81 = optionals withPHP81 php81-unit; postConfigure = '' ${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"} ${optionalString withPHP80 "./configure php --module=php80 --config=${php80-unit.unwrapped.dev}/bin/php-config --lib-path=${php80-unit}/lib"} + ${optionalString withPHP81 "./configure php --module=php81 --config=${php81-unit.unwrapped.dev}/bin/php-config --lib-path=${php81-unit}/lib"} ${optionalString withPerl532 "./configure perl --module=perl532 --perl=${perl532}/bin/perl"} ${optionalString withPerl534 "./configure perl --module=perl534 --perl=${perl534}/bin/perl"} ${optionalString withPerldevel "./configure perl --module=perldev --perl=${perldevel}/bin/perl"} ${optionalString withRuby_2_7 "./configure ruby --module=ruby27 --ruby=${ruby_2_7}/bin/ruby"} + ${optionalString withRuby_3_0 "./configure ruby --module=ruby30 --ruby=${ruby_3_0}/bin/ruby"} + ${optionalString withRuby_3_1 "./configure ruby --module=ruby31 --ruby=${ruby_3_1}/bin/ruby"} + ''; + + postInstall = '' + rmdir $out/state ''; passthru.tests.unit-php = nixosTests.unit-php;