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