summaryrefslogtreecommitdiffstats
path: root/nixos/tests/icingaweb2.nix
blob: 0103c14bbe2b2046107a39b8c215883fb62dc949 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ pkgs, ... }:
{
  name = "icingaweb2";
  meta.maintainers = with pkgs.lib.maintainers; [
    das_j
    helsinki-Jo
  ];

  nodes = {
    icingaweb2 =
      { config, pkgs, ... }:
      {
        services.icingaweb2 = {
          enable = true;

          modulePackages = with pkgs.icingaweb2Modules; {
            particles = theme-particles;
            spring = theme-spring;
          };

          modules = {
            doc.enable = true;
            migrate.enable = true;
            setup.enable = true;
            test.enable = true;
            translation.enable = true;
          };

          generalConfig = {
            global = {
              module_path = "${pkgs.icingaweb2}/modules";
            };
          };

          authentications = {
            icingaweb = {
              backend = "external";
            };
          };

          groupBackends = {
            icingaweb = {
              backend = "db";
              resource = "icingaweb_db";
            };
          };

          resources = {
            # Not used, so no DB server needed
            icingaweb_db = {
              type = "db";
              db = "mysql";
              host = "localhost";
              username = "icingaweb2";
              password = "icingaweb2";
              dbname = "icingaweb2";
            };
          };

          roles = {
            Administrators = {
              users = "*";
              permissions = "*";
            };
          };
        };
      };
  };

  testScript = ''
    start_all()
    icingaweb2.wait_for_unit("multi-user.target")
    icingaweb2.succeed("curl -sSf http://icingaweb2/authentication/login")
  '';
}