]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/mail/default.nix
Remove overlay that overrides the php version
[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 {
4 inherit (pkgs.webapps) roundcubemail roundcubemail-plugins roundcubemail-skins;
ab8f306d 5 env = config.myEnv.tools.roundcubemail;
afcc5de0 6 };
dcac3ec7
IB
7 rainloop = pkgs.callPackage ./rainloop.nix {
8 rainloop = pkgs.rainloop-community;
9 };
afcc5de0 10 cfg = config.myServices.websites.tools.email;
5400b9b6 11 pcfg = config.services.phpfpm.pools;
afcc5de0
IB
12in
13{
14 options.myServices.websites.tools.email = {
15 enable = lib.mkEnableOption "enable email website";
16 };
17
18 imports = [
19 ./mta-sts.nix
20 ];
21
22 config = lib.mkIf cfg.enable {
d2e703c5 23 services.duplyBackup.profiles.mail.excludeFile = ''
6a8252b1
IB
24 + ${rainloop.varDir}
25 + ${roundcubemail.varDir}
26 '';
afcc5de0
IB
27 secrets.keys = roundcubemail.keys;
28
29 services.websites.env.tools.modules =
30 [ "proxy_fcgi" ]
31 ++ rainloop.apache.modules
32 ++ roundcubemail.apache.modules;
33
34 services.websites.env.tools.vhostConfs.mail = {
35 certName = "mail";
36 addToCerts = true;
37 hosts = ["mail.immae.eu"];
38 root = "/run/current-system/webapps/_mail";
39 extraConfig = [
5400b9b6
IB
40 (rainloop.apache.vhostConf pcfg.rainloop.socket)
41 (roundcubemail.apache.vhostConf pcfg.roundcubemail.socket)
afcc5de0
IB
42 ''
43 <Directory /run/current-system/webapps/_mail>
44 Require all granted
45 Options -Indexes
46 </Directory>
47 ''
48 ];
49 };
50 systemd.services = {
51 phpfpm-rainloop = {
52 after = lib.mkAfter rainloop.phpFpm.serviceDeps;
53 wants = rainloop.phpFpm.serviceDeps;
54 };
55 phpfpm-roundcubemail = {
56 after = lib.mkAfter roundcubemail.phpFpm.serviceDeps;
57 wants = roundcubemail.phpFpm.serviceDeps;
58 };
59 };
60
61 services.phpfpm.pools.roundcubemail = {
5400b9b6
IB
62 user = "wwwrun";
63 group = "wwwrun";
64 settings = roundcubemail.phpFpm.pool;
dcac3ec7
IB
65 phpOptions = config.services.phpfpm.phpOptions + ''
66 date.timezone = 'CET'
67 extension=${pkgs.php72Packages.imagick}/lib/php/extensions/imagick.so
68 '';
69 phpPackage = pkgs.php72;
afcc5de0 70 };
441da8aa 71 services.phpfpm.pools.rainloop = {
5400b9b6
IB
72 user = "wwwrun";
73 group = "wwwrun";
74 settings = rainloop.phpFpm.pool;
dcac3ec7 75 phpPackage = pkgs.php72;
afcc5de0
IB
76 };
77 system.activationScripts = {
78 roundcubemail = roundcubemail.activationScript;
79 rainloop = rainloop.activationScript;
80 };
81
d3452fc5 82 services.websites.webappDirs = {
afcc5de0
IB
83 _mail = ./www;
84 "${roundcubemail.apache.webappName}" = roundcubemail.webRoot;
85 "${rainloop.apache.webappName}" = rainloop.webRoot;
86 };
87
88 };
89
90}