2 system ? builtins.currentSystem,
4 pkgs ? import ../.. { inherit system config; },
9 services.mediawiki.enable = true;
10 services.mediawiki.httpd.virtualHost.hostName = "localhost";
11 services.mediawiki.httpd.virtualHost.adminAddr = "root@example.com";
12 services.mediawiki.passwordFile = pkgs.writeText "password" "correcthorsebatterystaple";
13 services.mediawiki.extensions = {
14 Matomo = pkgs.fetchzip {
15 url = "https://github.com/DaSchTour/matomo-mediawiki-extension/archive/v4.0.1.tar.gz";
16 sha256 = "0g5rd3zp0avwlmqagc59cg9bbkn3r7wx7p6yr80s644mj6dlvs1b";
18 ParserFunctions = null;
22 testLib = import ../lib/testing-python.nix {
24 extraConfigurations = [ shared ];
28 mysql = testLib.makeTest {
29 name = "mediawiki-mysql";
31 services.mediawiki.database.type = "mysql";
36 machine.wait_for_unit("phpfpm-mediawiki.service")
38 page = machine.succeed("curl -fL http://localhost/")
39 assert "MediaWiki has been installed" in page
43 postgresql = testLib.makeTest {
44 name = "mediawiki-postgres";
46 services.mediawiki.database.type = "postgres";
51 machine.wait_for_unit("phpfpm-mediawiki.service")
53 page = machine.succeed("curl -fL http://localhost/")
54 assert "MediaWiki has been installed" in page
58 nohttpd = testLib.makeTest {
59 name = "mediawiki-nohttpd";
61 services.mediawiki.webserver = "none";
63 testScript = { nodes, ... }: ''
65 machine.wait_for_unit("phpfpm-mediawiki.service")
67 "SCRIPT_NAME=/index.php",
68 "SCRIPT_FILENAME=${nodes.machine.services.mediawiki.finalPackage}/share/mediawiki/index.php",
69 "REMOTE_ADDR=127.0.0.1",
70 'QUERY_STRING=title=Main_Page',
73 page = machine.succeed(f"{' '.join(env)} ${pkgs.fcgi}/bin/cgi-fcgi -bind -connect ${nodes.machine.services.phpfpm.pools.mediawiki.socket}")
74 assert "MediaWiki has been installed" in page, f"no 'MediaWiki has been installed' in:\n{page}"
78 nginx = testLib.makeTest {
79 name = "mediawiki-nginx";
81 services.mediawiki.webserver = "nginx";
86 machine.wait_for_unit("phpfpm-mediawiki.service")
87 machine.wait_for_unit("nginx.service")
89 page = machine.succeed("curl -fL http://localhost/")
90 assert "MediaWiki has been installed" in page