summary refs log tree commit diff stats
path: root/modules/hm
diff options
context:
space:
mode:
authorSilas Schöffel <sils@sils.li>2024-05-26 14:53:16 +0200
committerSilas Schöffel <sils@sils.li>2024-05-26 15:03:30 +0200
commitba43c8f608d250c762a97a17070fd7b0e471eb72 (patch)
tree8b50c528cf5c56e27a650aa30fe6199a879d0d84 /modules/hm
parentflake: remove unused args to outputs (diff)
downloadnix-config-ba43c8f608d250c762a97a17070fd7b0e471eb72.tar.gz
nix-config-ba43c8f608d250c762a97a17070fd7b0e471eb72.zip
mail: declare accounts
Diffstat (limited to 'modules/hm')
-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 {};
   };
 }