about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-08-08 00:41:26 +0900
committersefidel <contact@sefidel.net>2023-08-08 01:02:04 +0900
commit76bb322561b0e09c57574c350a58d76c9c798c78 (patch)
tree90171c282f9dcb202b5c8f31d67e311b43d61f86 /modules
parenta19e09946c86b4c92d24fa6adce8d834c3a3ba6f (diff)
downloadinfra-76bb322561b0e09c57574c350a58d76c9c798c78.tar.gz
infra-76bb322561b0e09c57574c350a58d76c9c798c78.zip
feat(modules/nixos-mailserver): add roundcube webmail
Diffstat (limited to 'modules')
-rw-r--r--modules/services/nixos-mailserver.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/services/nixos-mailserver.nix b/modules/services/nixos-mailserver.nix
index 59571bc..81d017f 100644
--- a/modules/services/nixos-mailserver.nix
+++ b/modules/services/nixos-mailserver.nix
@@ -9,6 +9,15 @@ in
 
   options.modules.services.nixos-mailserver = {
     enable = mkEnableOption "nixos-mailserver";
+    webmail = {
+      enable = mkOption {
+        type = types.bool;
+        default = false;
+        description = lib.mdDoc "Whether to enable roundcube webmail";
+      };
+      domain = mkOption { type = types.str; };
+      realHost = mkOption { type = types.str; };
+    };
   };
 
   config = mkIf cfg.enable {
@@ -108,6 +117,27 @@ in
       virusScanning = false;
     };
 
+    services.roundcube = mkIf cfg.webmail.enable {
+      enable = true;
+      hostName = cfg.webmail.realHost;
+      database.host = "localhost"; # use localDB, pgsql db/user creation is done automatically.
+
+      plugins = [
+        "archive"
+        "enigma"
+        "help"
+        "markasjunk"
+        "vcard_attachments"
+        "zipdownload"
+      ];
+    };
+
+    services.nginx.virtualHosts.${cfg.webmail.realHost} = {
+      enableACME = mkForce false; # conflicts with useACMEHost
+      forceSSL = true;
+      useACMEHost = cfg.webmail.domain;
+    };
+
     environment.persistence."/persist".directories = [
       "/var/lib/dovecot"
       "/var/lib/rspamd"