summaryrefslogtreecommitdiffstats
path: root/nixos/tests/web-apps/karakeep.nix
blob: a7d46f39a4fc3d3d2aea6b78ebc266d81f2b847e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{ lib, ... }:
let
  port = 3001;
  host = "karakeep_server";
in
{
  name = "karakeep";
  meta.maintainers = with lib.maintainers; [ tetov ];

  nodes.${host} = {
    networking.firewall.allowedTCPPorts = [ port ];

    services.karakeep = {
      enable = true;
      extraEnvironment = {
        HOST = host;
        PORT = toString port;
        DISABLE_NEW_RELEASE_CHECK = "true";
      };
      meilisearch.enable = true;
    };
  };

  testScript = ''
    import json

    ${host}.wait_for_unit("karakeep-web")

    resp = json.loads(${host}.wait_until_succeeds("curl -sS -f http://${host}:${toString port}/api/health", timeout=300))

    assert resp["status"] == "ok"
  '';
}