summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--modules/hm/sils/mail.nix94
1 files changed, 93 insertions, 1 deletions
diff --git a/modules/hm/sils/mail.nix b/modules/hm/sils/mail.nix
index 77d085c..06f6917 100644
--- a/modules/hm/sils/mail.nix
+++ b/modules/hm/sils/mail.nix
@@ -1,9 +1,18 @@
 {
   config,
   lib,
+  pkgs,
   ...
 }: let
   cfg = config.sils.mail;
+  vhackImap = {
+    host = "server1.vhack.eu";
+    port = 993;
+  };
+  vhackSmtp = {
+    host = "server1.vhack.eu";
+    port = 993;
+  };
 in {
   options.sils.mail.enable = lib.mkOption {
     type = lib.types.bool;
@@ -11,8 +20,91 @@ in {
     description = "Enable sophisticated mail setup";
   };
   config = lib.mkIf cfg.enable {
-    programs.neomutt = {
+    accounts.email = {
+      maildirBasePath = "${config.xdg.dataHome}/maildir";
+      accounts = {
+        "sils@sils.li" = {
+          address = "sils@sils.li";
+          userName = "sils@sils.li";
+          realName = "Silas Schöffel";
+          passwordCommand = "${lib.getExe pkgs.libsecret} lookup account sils@sils.li";
+          gpg = {
+            encryptByDefault = true;
+            signByDefault = true;
+            key = "C1DAA551B4227A6F3FD96B3A467B7D129EA73AC9";
+          };
+          smtp = vhackSmtp;
+          imap = vhackImap;
+
+          neomutt.enable = true;
+          maildir.path = "sils@sils.li";
+          mbsync = {
+            enable = true;
+            create = "both";
+          };
+        };
+        "silas.schoeffel@s-schoeffel.de" = {
+          address = "silas.schoeffel@s-schoeffel.de";
+          userName = "silas.schoeffel@s-schoeffel.de";
+          realName = "Silas Schöffel";
+          primary = true;
+          passwordCommand = "${lib.getExe pkgs.libsecret} lookup account silas.schoeffel@s-schoeffel.de";
+          gpg = {
+            encryptByDefault = true;
+            signByDefault = true;
+            key = "C1DAA551B4227A6F3FD96B3A467B7D129EA73AC9";
+          };
+          smtp = vhackSmtp;
+          imap = vhackImap;
+
+          neomutt.enable = true;
+          maildir.path = "silas.schoeffel@s-schoeffel.de";
+          mbsync = {
+            enable = true;
+            create = "both";
+          };
+        };
+        "sils@vhack.eu" = {
+          address = "sils@vhack.eu";
+          userName = "sils@vhack.eu";
+          realName = "Silas Schöffel";
+          aliases = [
+            "admin@vhack.eu"
+            "postmaster@vhack.eu"
+            "webmaster@vhack.eu"
+          ];
+          passwordCommand = "${lib.getExe pkgs.libsecret} lookup account sils@vhack.eu";
+          gpg = {
+            encryptByDefault = true;
+            signByDefault = true;
+            key = "C1DAA551B4227A6F3FD96B3A467B7D129EA73AC9";
+          };
+          smtp = vhackSmtp;
+          imap = vhackImap;
+
+          neomutt.enable = true;
+          maildir.path = "sils@vhack.eu";
+          mbsync = {
+            enable = true;
+            create = "both";
+          };
+        };
+      };
+    };
+    programs = {
+      neomutt = {
+        enable = true;
+        package = pkgs.writeShellScriptBin "neomutt" ''
+          systemctl --user start mbsync.service;
+          ${lib.getExe pkgs.neomutt}
+        '';
+        checkStatsInterval = 60;
+      };
+      mbsync.enable = true;
+    };
+    services.mbsync = {
       enable = true;
     };
+    systemd.user.timers.mbsync = lib.mkForce {};
   };
 }