1 { lib, pkgs, config, ... }:
3 roundcubemail = pkgs.callPackage ./roundcubemail.nix {
4 inherit (pkgs.webapps) roundcubemail;
5 env = config.myEnv.tools.roundcubemail;
7 rainloop = pkgs.callPackage ./rainloop.nix {
8 rainloop = pkgs.rainloop-community;
10 cfg = config.myServices.websites.tools.email;
11 pcfg = config.services.phpfpm.pools;
14 options.myServices.websites.tools.email = {
15 enable = lib.mkEnableOption "enable email website";
22 config = lib.mkIf cfg.enable {
23 services.duplyBackup.profiles.mail.excludeFile = ''
25 + ${roundcubemail.varDir}
27 secrets.keys = roundcubemail.keys;
29 services.websites.env.tools.modules =
31 ++ rainloop.apache.modules
32 ++ roundcubemail.apache.modules;
34 services.websites.env.tools.vhostConfs.mail = {
37 hosts = ["mail.immae.eu"];
38 root = "/run/current-system/webapps/_mail";
40 (rainloop.apache.vhostConf pcfg.rainloop.socket)
41 (roundcubemail.apache.vhostConf pcfg.roundcubemail.socket)
43 <Directory /run/current-system/webapps/_mail>
52 after = lib.mkAfter rainloop.phpFpm.serviceDeps;
53 wants = rainloop.phpFpm.serviceDeps;
55 phpfpm-roundcubemail = {
56 after = lib.mkAfter roundcubemail.phpFpm.serviceDeps;
57 wants = roundcubemail.phpFpm.serviceDeps;
61 services.phpfpm.pools.roundcubemail = {
64 settings = roundcubemail.phpFpm.pool;
65 phpOptions = config.services.phpfpm.phpOptions + ''
68 phpPackage = pkgs.php72.withExtensions(e: pkgs.php72.enabledExtensions ++ [ e.imagick ]);
70 services.phpfpm.pools.rainloop = {
73 settings = rainloop.phpFpm.pool;
74 phpPackage = pkgs.php72;
76 system.activationScripts = {
77 roundcubemail = roundcubemail.activationScript;
78 rainloop = rainloop.activationScript;
81 services.websites.webappDirs = {
83 "${roundcubemail.apache.webappName}" = roundcubemail.webRoot;
84 "${rainloop.apache.webappName}" = rainloop.webRoot;