about summary refs log tree commit diff
path: root/nixos/tests/sogo.nix
blob: e9059a2ab7734b8e8eb5bf83a7ce5457ea62c0f0 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import ./make-test-python.nix ({ pkgs, ... }: {
  name = "sogo";
  meta = with pkgs.lib.maintainers; {
    maintainers = [];
  };

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

      services.mysql = {
        enable = true;
        package = pkgs.mariadb;
        ensureDatabases = [ "sogo" ];
        ensureUsers = [{
          name = "sogo";
          ensurePermissions = {
            "sogo.*" = "ALL PRIVILEGES";
          };
        }];
      };

      services.sogo = {
        enable = true;
        timezone = "Europe/Berlin";
        extraConfig = ''
          WOWorkersCount = 1;

          SOGoUserSources = (
            {
              type = sql;
              userPasswordAlgorithm = md5;
              viewURL = "mysql://sogo@%2Frun%2Fmysqld%2Fmysqld.sock/sogo/sogo_users";
              canAuthenticate = YES;
              id = users;
            }
          );

          SOGoProfileURL = "mysql://sogo@%2Frun%2Fmysqld%2Fmysqld.sock/sogo/sogo_user_profile";
          OCSFolderInfoURL = "mysql://sogo@%2Frun%2Fmysqld%2Fmysqld.sock/sogo/sogo_folder_info";
          OCSSessionsFolderURL = "mysql://sogo@%2Frun%2Fmysqld%2Fmysqld.sock/sogo/sogo_sessions_folder";
          OCSEMailAlarmsFolderURL = "mysql://sogo@%2Frun%2Fmysqld%2Fmysqld.sock/sogo/sogo_alarms_folder";
          OCSStoreURL = "mysql://sogo@%2Frun%2Fmysqld%2Fmysqld.sock/sogo/sogo_store";
          OCSAclURL = "mysql://sogo@%2Frun%2Fmysqld%2Fmysqld.sock/sogo/sogo_acl";
          OCSCacheFolderURL = "mysql://sogo@%2Frun%2Fmysqld%2Fmysqld.sock/sogo/sogo_cache_folder";
        '';
      };
    };
  };

  testScript = ''
    start_all()
    sogo.wait_for_unit("multi-user.target")
    sogo.wait_for_open_port(20000)
    sogo.wait_for_open_port(80)
    sogo.succeed("curl -sSfL http://sogo/SOGo")
  '';
})