]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, ... }: | |
2 | let | |
3 | roundcubemail = pkgs.callPackage ./roundcubemail.nix { | |
4 | inherit (pkgs.webapps) roundcubemail roundcubemail-plugins roundcubemail-skins; | |
5 | env = config.myEnv.tools.roundcubemail; | |
6 | }; | |
7 | rainloop = pkgs.callPackage ./rainloop.nix {}; | |
8 | cfg = config.myServices.websites.tools.email; | |
9 | pcfg = config.services.phpfpm.pools; | |
10 | in | |
11 | { | |
12 | options.myServices.websites.tools.email = { | |
13 | enable = lib.mkEnableOption "enable email website"; | |
14 | }; | |
15 | ||
16 | imports = [ | |
17 | ./mta-sts.nix | |
18 | ]; | |
19 | ||
20 | config = lib.mkIf cfg.enable { | |
21 | services.duplyBackup.profiles.mail.excludeFile = '' | |
22 | + ${rainloop.varDir} | |
23 | + ${roundcubemail.varDir} | |
24 | ''; | |
25 | secrets.keys = roundcubemail.keys; | |
26 | ||
27 | services.websites.env.tools.modules = | |
28 | [ "proxy_fcgi" ] | |
29 | ++ rainloop.apache.modules | |
30 | ++ roundcubemail.apache.modules; | |
31 | ||
32 | services.websites.env.tools.vhostConfs.mail = { | |
33 | certName = "mail"; | |
34 | addToCerts = true; | |
35 | hosts = ["mail.immae.eu"]; | |
36 | root = "/run/current-system/webapps/_mail"; | |
37 | extraConfig = [ | |
38 | (rainloop.apache.vhostConf pcfg.rainloop.socket) | |
39 | (roundcubemail.apache.vhostConf pcfg.roundcubemail.socket) | |
40 | '' | |
41 | <Directory /run/current-system/webapps/_mail> | |
42 | Require all granted | |
43 | Options -Indexes | |
44 | </Directory> | |
45 | '' | |
46 | ]; | |
47 | }; | |
48 | systemd.services = { | |
49 | phpfpm-rainloop = { | |
50 | after = lib.mkAfter rainloop.phpFpm.serviceDeps; | |
51 | wants = rainloop.phpFpm.serviceDeps; | |
52 | }; | |
53 | phpfpm-roundcubemail = { | |
54 | after = lib.mkAfter roundcubemail.phpFpm.serviceDeps; | |
55 | wants = roundcubemail.phpFpm.serviceDeps; | |
56 | }; | |
57 | }; | |
58 | ||
59 | services.phpfpm.pools.roundcubemail = { | |
60 | user = "wwwrun"; | |
61 | group = "wwwrun"; | |
62 | settings = roundcubemail.phpFpm.pool; | |
63 | phpOptions = config.services.phpfpm.phpOptions + roundcubemail.phpFpm.phpConfig; | |
64 | }; | |
65 | services.phpfpm.pools.rainloop = { | |
66 | user = "wwwrun"; | |
67 | group = "wwwrun"; | |
68 | settings = rainloop.phpFpm.pool; | |
69 | }; | |
70 | system.activationScripts = { | |
71 | roundcubemail = roundcubemail.activationScript; | |
72 | rainloop = rainloop.activationScript; | |
73 | }; | |
74 | ||
75 | services.websites.webappDirs = { | |
76 | _mail = ./www; | |
77 | "${roundcubemail.apache.webappName}" = roundcubemail.webRoot; | |
78 | "${rainloop.apache.webappName}" = rainloop.webRoot; | |
79 | }; | |
80 | ||
81 | }; | |
82 | ||
83 | } |