{ pkgs, lib, hostPath, ... }: let inherit (lib.modules) mkForce; localContainersAddresses = import "${hostPath}/data/containerAddresses.nix"; in { services.roundcube = { enable = true; hostName = "mail.owo.monster"; package = pkgs.roundcube.withPlugins (_plugins: with pkgs.roundcubePlugins; [ persistent_login ]); plugins = [ "persistent_login" "managesieve" ]; database = { host = localContainersAddresses.containers.postgresql; passwordFile = builtins.toFile "pw" ""; }; extraConfig = '' $config['smtp_server'] = "tls://mail.owo.monster"; $config['smtp_user'] = "%u"; $config['smtp_pass'] = "%p"; $config['managesieve_host'] = 'tls://mail.owo.monster'; $config['session_lifetime'] = (60 * 24 * 7 * 2); # 2 Weeks $config['product_name'] = 'Chaos Mail'; $config['username_domain'] = "owo.monster"; $config['username_domain_forced'] = true; $config['log_driver'] = 'syslog'; $config['smtp_debug'] = true; ''; }; systemd.tmpfiles.rules = [ "d /var/sockets - nginx nginx" ]; systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/sockets" ]; services.nginx.virtualHosts."mail.owo.monster" = { forceSSL = mkForce false; enableACME = mkForce false; extraConfig = "listen unix:/var/sockets/roundcube.sock;"; }; }