1 import ./make-test-python.nix ({ ... }: {
2 name = "trilium-server";
5 services.trilium-server.enable = true;
8 services.trilium-server = {
10 dataDir = "/data/trilium";
15 services.trilium-server = {
18 nginx.hostName = "trilium.example.com";
27 with subtest("by default works without configuration"):
28 default.wait_for_unit("trilium-server.service")
30 with subtest("by default available on port 8080"):
31 default.wait_for_unit("trilium-server.service")
32 default.wait_for_open_port(8080)
33 # we output to /dev/null here to avoid a python UTF-8 decode error
34 # but the check will still fail if the service doesn't respond
35 default.succeed("curl --fail -o /dev/null 127.0.0.1:8080")
37 with subtest("by default creates empty document"):
38 default.wait_for_unit("trilium-server.service")
39 default.succeed("test -f /var/lib/trilium/document.db")
41 with subtest("configured with custom data store"):
42 configured.wait_for_unit("trilium-server.service")
43 configured.succeed("test -f /data/trilium/document.db")
45 with subtest("nginx with custom host name"):
46 nginx.wait_for_unit("trilium-server.service")
47 nginx.wait_for_unit("nginx.service")
50 "curl --resolve 'trilium.example.com:80:127.0.0.1' http://trilium.example.com/"