From ba43c8f608d250c762a97a17070fd7b0e471eb72 Mon Sep 17 00:00:00 2001 From: Silas Schöffel Date: Sun, 26 May 2024 14:53:16 +0200 Subject: mail: declare accounts --- modules/hm/sils/mail.nix | 94 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) 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 {}; }; } -- cgit 1.4.1