tests/nixos/demo-wiki.nix
nixosConfigurations.demo-wiki (nixos/demo-wiki.nix) in a VM: without the EC2 metadata service and Let's Encrypt, which the VM has neither of, so lighttpd serves ACME's self-signed certificate.
λfilnix
let
λlib, …
The test VM's disk has no partition to grow.
false
false
false
used by nodes.machine nodes.target
in
"demo-wiki"
The system filnix-update switches to: another build of this one, whose filnix-update unit differs, as each release's does.
λlib, nodes, …
filnix-update as on the box, switching to the target instead of a release from GitHub, which the VM cannot reach.
uses wiki
λnodes, …
machine.wait_for_unit("lighttpd.service")
machine.wait_for_unit("phpfpm-mediawiki.service")
machine.wait_for_open_port(443)
with subtest("HTTP redirects to HTTPS, which serves the wiki"):
out = machine.succeed("curl -sS -o /dev/null -w '%{http_code} %{redirect_url}' http://filc.less.rest/index.php")
assert out.startswith("301 https://filc.less.rest/"), out
page = machine.succeed("curl -fsSk https://filc.less.rest/index.php?title=Main_Page")
assert "Fil-C wiki" in page, page[:500]
with subtest("anonymous users cannot edit or create accounts"):
edit = machine.succeed("curl -fsSk 'https://filc.less.rest/index.php?title=Main_Page&action=edit'")
assert "wpTextbox1" not in edit or "readonly" in edit, "the edit form is open"
signup = machine.succeed("curl -fsSk 'https://filc.less.rest/index.php?title=Special:CreateAccount'")
assert "wpCreateaccount" not in signup, "account creation is open"
with subtest("the status page lists filc-ps"):
machine.systemctl("start filc-status.service")
status = machine.succeed("curl -fsSk https://filc.less.rest/status/")
print(status)
assert "0 not allowed" in status, status
with subtest("lighttpd and php-fpm are Fil-C"):
for unit in ["lighttpd", "phpfpm-mediawiki"]:
pid = machine.succeed(f"systemctl show -p MainPID --value {unit}").strip()
machine.succeed(f"grep -q libpizlo /proc/{pid}/maps")
with subtest("filnix-update survives the switch it runs"):
# Its unit changes in the switch; restarting it there killed it
# before it wrote the tag (filc.less.rest, v2026.11.06).
machine.succeed("systemctl start filnix-update.service")
current = machine.succeed("readlink -f /run/current-system").strip()
assert current == "${nodes.target.system.build.toplevel}", current
machine.succeed("test \"$(cat /var/lib/filnix-update/tag)\" = next")
machine.succeed("systemctl show -p Result --value filnix-update | grep -qx success")
machine.wait_until_succeeds("grep -q 'filnix-update: next' /var/lib/filc-status/index.txt")
print(machine.succeed("head -4 /var/lib/filc-status/index.txt"))