]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/mail/default.nix
Remove duply-backup
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / mail / default.nix
CommitLineData
ab8f306d 1{ lib, pkgs, config, ... }:
afcc5de0
IB
2let
3 roundcubemail = pkgs.callPackage ./roundcubemail.nix {
34c7b88e 4 inherit (pkgs.webapps) roundcubemail;
ab8f306d 5 env = config.myEnv.tools.roundcubemail;
da30ae4f 6 inherit config;
afcc5de0 7 };
dcac3ec7
IB
8 rainloop = pkgs.callPackage ./rainloop.nix {
9 rainloop = pkgs.rainloop-community;
10 };
afcc5de0 11 cfg = config.myServices.websites.tools.email;
5400b9b6 12 pcfg = config.services.phpfpm.pools;
afcc5de0
IB
13in
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 secrets.keys = roundcubemail.keys;
25
26 services.websites.env.tools.modules =
27 [ "proxy_fcgi" ]
28 ++ rainloop.apache.modules
29 ++ roundcubemail.apache.modules;
30
31 services.websites.env.tools.vhostConfs.mail = {
32 certName = "mail";
33 addToCerts = true;
34 hosts = ["mail.immae.eu"];
750fe5a4 35 root = ./www;
afcc5de0 36 extraConfig = [
5400b9b6
IB
37 (rainloop.apache.vhostConf pcfg.rainloop.socket)
38 (roundcubemail.apache.vhostConf pcfg.roundcubemail.socket)
afcc5de0 39 ''
750fe5a4 40 <Directory ${./www}>
afcc5de0
IB
41 Require all granted
42 Options -Indexes
43 </Directory>
44 ''
45 ];
46 };
47 systemd.services = {
48 phpfpm-rainloop = {
49 after = lib.mkAfter rainloop.phpFpm.serviceDeps;
50 wants = rainloop.phpFpm.serviceDeps;
51 };
52 phpfpm-roundcubemail = {
53 after = lib.mkAfter roundcubemail.phpFpm.serviceDeps;
54 wants = roundcubemail.phpFpm.serviceDeps;
55 };
56 };
57
58 services.phpfpm.pools.roundcubemail = {
5400b9b6
IB
59 user = "wwwrun";
60 group = "wwwrun";
61 settings = roundcubemail.phpFpm.pool;
dcac3ec7
IB
62 phpOptions = config.services.phpfpm.phpOptions + ''
63 date.timezone = 'CET'
dcac3ec7 64 '';
2053ddac 65 phpPackage = pkgs.php72.withExtensions({ enabled, all }: enabled ++ [ all.imagick ]);
afcc5de0 66 };
441da8aa 67 services.phpfpm.pools.rainloop = {
5400b9b6
IB
68 user = "wwwrun";
69 group = "wwwrun";
70 settings = rainloop.phpFpm.pool;
dcac3ec7 71 phpPackage = pkgs.php72;
afcc5de0
IB
72 };
73 system.activationScripts = {
74 roundcubemail = roundcubemail.activationScript;
75 rainloop = rainloop.activationScript;
76 };
afcc5de0
IB
77 };
78
79}