1 { lib, pkgs, config, myconfig, ... }:
3 roundcubemail = pkgs.callPackage ./roundcubemail.nix {
4 inherit (pkgs.webapps) roundcubemail roundcubemail-plugins roundcubemail-skins;
5 env = myconfig.env.tools.roundcubemail;
7 rainloop = pkgs.callPackage ./rainloop.nix {};
8 cfg = config.myServices.websites.tools.email;
11 options.myServices.websites.tools.email = {
12 enable = lib.mkEnableOption "enable email website";
19 config = lib.mkIf cfg.enable {
20 secrets.keys = roundcubemail.keys;
22 services.websites.env.tools.modules =
24 ++ rainloop.apache.modules
25 ++ roundcubemail.apache.modules;
27 services.websites.env.tools.vhostConfs.mail = {
30 hosts = ["mail.immae.eu"];
31 root = "/run/current-system/webapps/_mail";
33 rainloop.apache.vhostConf
34 roundcubemail.apache.vhostConf
36 <Directory /run/current-system/webapps/_mail>
45 after = lib.mkAfter rainloop.phpFpm.serviceDeps;
46 wants = rainloop.phpFpm.serviceDeps;
48 phpfpm-roundcubemail = {
49 after = lib.mkAfter roundcubemail.phpFpm.serviceDeps;
50 wants = roundcubemail.phpFpm.serviceDeps;
54 services.phpfpm.pools.roundcubemail = {
55 listen = roundcubemail.phpFpm.socket;
56 extraConfig = roundcubemail.phpFpm.pool;
57 phpOptions = config.services.phpfpm.phpOptions + roundcubemail.phpFpm.phpConfig;
59 services.phpfpm.poolConfigs = {
60 rainloop = rainloop.phpFpm.pool;
62 system.activationScripts = {
63 roundcubemail = roundcubemail.activationScript;
64 rainloop = rainloop.activationScript;
67 myServices.websites.webappDirs = {
69 "${roundcubemail.apache.webappName}" = roundcubemail.webRoot;
70 "${rainloop.apache.webappName}" = rainloop.webRoot;