1{ lib, ... }:
2{
3 name = "gotosocial";
4 meta.maintainers = with lib.maintainers; [ blakesmith ];
5
6 nodes.machine =
7 { pkgs, ... }:
8 {
9 environment.systemPackages = [ pkgs.jq ];
10 services.gotosocial = {
11 enable = true;
12 setupPostgresqlDB = true;
13 settings = {
14 host = "localhost:8081";
15 port = 8081;
16 instance-stats-mode = "serve";
17 };
18 };
19 };
20
21 testScript = ''
22 machine.wait_for_unit("gotosocial.service")
23 machine.wait_for_unit("postgresql.target")
24 machine.wait_for_open_port(8081)
25 # Database migrations are running, wait until gotosocial no longer serves 503
26 machine.wait_until_succeeds("curl -sS -f http://localhost:8081/readyz", timeout=300)
27
28 # check user registration via cli
29 machine.succeed("gotosocial-admin account create --username nickname --email email@example.com --password kurtz575VPeBgjVm")
30 machine.wait_until_succeeds("curl -sS -f http://localhost:8081/nodeinfo/2.0 | jq '.usage.users.total' | grep -q '^1$'")
31 '';
32}