about summary refs log tree commit diff
path: root/nixos/tests/mobilizon.nix
blob: 2b070ca9d96091b5b58d6db79ac43a59dc66c581 (plain) (blame)
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
34
35
36
37
38
39
40
41
42
43
44
import ./make-test-python.nix ({ lib, ... }:
  let
    certs = import ./common/acme/server/snakeoil-certs.nix;
    mobilizonDomain = certs.domain;
    port = 41395;
  in

  {
    name = "mobilizon";
    meta.maintainers = with lib.maintainers; [ minijackson erictapen ];

    nodes.server =
      { ... }:
      {
        services.mobilizon = {
          enable = true;
          settings = {
            ":mobilizon" = {
              ":instance" = {
                name = "Test Mobilizon";
                hostname = mobilizonDomain;
              };
              "Mobilizon.Web.Endpoint".http.port = port;
            };
          };
        };

        security.pki.certificateFiles = [ certs.ca.cert ];

        services.nginx.virtualHosts."${mobilizonDomain}" = {
          enableACME = lib.mkForce false;
          sslCertificate = certs.${mobilizonDomain}.cert;
          sslCertificateKey = certs.${mobilizonDomain}.key;
        };

        networking.hosts."::1" = [ mobilizonDomain ];
      };

    testScript = ''
      server.wait_for_unit("mobilizon.service")
      server.wait_for_open_port(${toString port})
      server.succeed("curl --fail https://${mobilizonDomain}/")
    '';
  })