aboutsummaryrefslogtreecommitdiff
path: root/systems/eldiron/websites/dav/default.nix
blob: 109715dfd39254df55e73200f7d3ecee1a7e0cfa (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{ lib, pkgs, config,  ... }:
let
    infcloud = rec {
      root = pkgs.webapps-infcloud;
      vhostConf = ''
          Alias /carddavmate ${root}
          Alias /caldavzap ${root}
          Alias /infcloud ${root}
          <Directory ${root}>
            AllowOverride All
            Options FollowSymlinks
            Require all granted
            DirectoryIndex index.html
          </Directory>
      '';
    };
    davical = pkgs.callPackage ./davical.nix {
      env = config.myEnv.tools.davical;
      davical = pkgs.webapps-davical;
      awl = pkgs.webapps-awl;
      inherit config;
    };

    cfg = config.myServices.websites.tools.dav;
in {
  options.myServices.websites.tools.dav = {
    enable = lib.mkEnableOption "enable dav website";
  };

  config = lib.mkIf cfg.enable {
    myServices.dns.zones."immae.eu".subdomains.dav =
      with config.myServices.dns.helpers; ips servers.eldiron.ips.main;

    myServices.chatonsProperties.services = {
      davical = {
        file.datetime = "2022-08-21T01:33:00";
        service = {
          name = "Davical";
          description = "DAViCal is a server for calendar sharing";
          website = "https://dav.immae.eu";
          logo = "https://www.davical.org/images/logo.gif";
          status.level = "OK";
          status.description = "OK";
          registration."" = ["MEMBER" "CLIENT"];
          registration.load = "OPEN";
          install.type = "PACKAGE";
        };
        software = {
          name = "Davical";
          website = "https://www.davical.org/";
          license.url = "https://gitlab.com/davical-project/davical/-/blob/master/COPYING";
          license.name = "GNU General Public License Version 2";
          version = pkgs.webapps-davical.version;
          source.url = "https://gitlab.com/davical-project/davical/";
          modules = "infcloud";
        };
      };
      #calendar = {
      #  file.datetime = "2022-08-22T00:00:00";
      #  service = {
      #    name = "Calendar";
      #    description = "Opensource CalDAV web client";
      #    website = "https://dav.immae.eu/caldavzap/";
      #    logo = "https://dav.immae.eu/caldavzap/images/infcloud_logo.svg";
      #    status.level = "OK";
      #    status.description = "OK";
      #    registration."" = ["MEMBER" "CLIENT"];
      #    registration.load = "OPEN";
      #    install.type = "PACKAGE";
      #  };
      #  software = {
      #    name = "InfCloud";
      #    website = "https://inf-it.com/open-source/clients/infcloud/";
      #    license.url = "https://www.gnu.org/licenses/agpl-3.0.en.html";
      #    license.name = "GNU Affero General Public License (version 3.0)";
      #    version = pkgs.webapps-infcloud.version;
      #    source.url = "https://inf-it.com/open-source/clients/infcloud/";
      #  };
      #};
      #contacts = {
      #  file.datetime = "2022-08-22T00:00:00";
      #  service = {
      #    name = "Contacts";
      #    description = "Opensource Carddav web client";
      #    website = "https://dav.immae.eu/carddavmate/";
      #    logo = "https://dav.immae.eu/caldavzap/images/infcloud_logo.svg";
      #    status.level = "OK";
      #    status.description = "OK";
      #    registration."" = ["MEMBER" "CLIENT"];
      #    registration.load = "OPEN";
      #    install.type = "PACKAGE";
      #  };
      #  software = {
      #    name = "InfCloud";
      #    website = "https://inf-it.com/open-source/clients/infcloud/";
      #    license.url = "https://www.gnu.org/licenses/agpl-3.0.en.html";
      #    license.name = "GNU Affero General Public License (version 3.0)";
      #    version = pkgs.webapps-infcloud.version;
      #    source.url = "https://inf-it.com/open-source/clients/infcloud/";
      #  };
      #};
    };
    secrets.keys = davical.keys;
    services.websites.env.tools.modules = davical.apache.modules;

    security.acme.certs.eldiron.extraDomainNames = [ "dav.immae.eu" ];
    services.websites.env.tools.vhostConfs.dav = {
      certName    = "eldiron";
      hosts       = ["dav.immae.eu" ];
      root        = ./www;
      extraConfig = [
        infcloud.vhostConf
        (davical.apache.vhostConf config.services.phpfpm.pools.davical.socket)
      ];
    };

    services.phpfpm.pools = {
      davical = {
        user = config.services.websites.env.tools.user;
        group = config.services.websites.env.tools.group;
        settings = davical.phpFpm.pool;
        phpPackage = pkgs.php72.withExtensions({ enabled, all }: enabled ++ [all.redis]);
      };
    };
    myServices.monitoring.fromMasterActivatedPlugins = [ "http" ];
    myServices.monitoring.fromMasterObjects.service = [
      {
        service_description = "davical website is running on dav.immae.eu";
        host_name = config.hostEnv.fqdn;
        use = "external-web-service";
        check_command = ["check_https" "dav.immae.eu" "/davical/" "Log On Please"];

        servicegroups = "webstatus-webapps";
        _webstatus_name = "Davical";
        _webstatus_url = "https://dav.immae.eu/davical";
      }
    ];
  };
}