1 import ./make-test-python.nix ({ pkgs, ... }:
4 template-bootstrap3 = pkgs.stdenv.mkDerivation {
6 # Download the theme from the dokuwiki site
8 url = "https://github.com/giterlizzi/dokuwiki-template-bootstrap3/archive/v2019-05-22.zip";
9 sha256 = "4de5ff31d54dd61bbccaf092c9e74c1af3a4c53e07aa59f60457a8f00cfb23a6";
11 # We need unzip to build this package
12 nativeBuildInputs = [ pkgs.unzip ];
13 # Installing simply means copying all files to the output directory
14 installPhase = "mkdir -p $out; cp -R * $out/";
18 # Let's package the icalevents plugin
19 plugin-icalevents = pkgs.stdenv.mkDerivation {
21 # Download the plugin from the dokuwiki site
23 url = "https://github.com/real-or-random/dokuwiki-plugin-icalevents/releases/download/2017-06-16/dokuwiki-plugin-icalevents-2017-06-16.zip";
24 sha256 = "e40ed7dd6bbe7fe3363bbbecb4de481d5e42385b5a0f62f6a6ce6bf3a1f9dfa8";
26 # We need unzip to build this package
27 nativeBuildInputs = [ pkgs.unzip ];
29 # Installing simply means copying all files to the output directory
30 installPhase = "mkdir -p $out; cp -R * $out/";
35 meta = with pkgs.lib; {
36 maintainers = with maintainers; [
43 dokuwiki_nginx = {...}: {
51 usersFile = "/var/lib/dokuwiki/site2.local/users.auth.php";
53 templates = [ template-bootstrap3 ];
54 plugins = [ plugin-icalevents ];
59 networking.firewall.allowedTCPPorts = [ 80 ];
60 networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
63 dokuwiki_caddy = {...}: {
72 usersFile = "/var/lib/dokuwiki/site2.local/users.auth.php";
74 templates = [ template-bootstrap3 ];
75 plugins = [ plugin-icalevents ];
80 networking.firewall.allowedTCPPorts = [ 80 ];
81 networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
90 dokuwiki_nginx.wait_for_unit("nginx")
91 dokuwiki_caddy.wait_for_unit("caddy")
93 site_names = ["site1.local", "site2.local"]
95 for machine in (dokuwiki_nginx, dokuwiki_caddy):
96 for site_name in site_names:
97 machine.wait_for_unit(f"phpfpm-dokuwiki-{site_name}")
99 machine.succeed("curl -sSfL http://site1.local/ | grep 'DokuWiki'")
100 machine.fail("curl -sSfL 'http://site1.local/doku.php?do=login' | grep 'Login'")
102 machine.succeed("curl -sSfL http://site2.local/ | grep 'DokuWiki'")
103 machine.succeed("curl -sSfL 'http://site2.local/doku.php?do=login' | grep 'Login'")
106 "echo 'admin:$2y$10$ijdBQMzSVV20SrKtCna8gue36vnsbVm2wItAXvdm876sshI4uwy6S:Admin:admin@example.test:user' >> /var/lib/dokuwiki/site2.local/users.auth.php",
107 "curl -sSfL -d 'u=admin&p=password' --cookie-jar cjar 'http://site2.local/doku.php?do=login'",
108 "curl -sSfL --cookie cjar --cookie-jar cjar 'http://site2.local/doku.php?do=login' | grep 'Logged in as: <bdi>Admin</bdi>'",