Skip to content

Commit

Permalink
Merge pull request NixOS#89224 from etu/fix-unit-php-extensions
Browse files Browse the repository at this point in the history
unit: Expose PHP expressions used so it can easily be accessed for configs
  • Loading branch information
flokli authored May 31, 2020
2 parents 2168036 + a4bf2cc commit 8ae5866
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 12 additions & 2 deletions nixos/tests/web-servers/unit-php.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
Expand All @@ -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"
'';
})
5 changes: 5 additions & 0 deletions pkgs/servers/http/unit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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-config --lib-path=${python2}/lib"}
${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"}
Expand Down

0 comments on commit 8ae5866

Please sign in to comment.