{ config, lib, pkgs, ... }: let name = "HackerNCoder"; email = "hackerncoder@encryptionin.space"; host = "mail.encryptionin.space"; maildir = "/home/ed/.mail"; in { accounts.email = { maildirBasePath = "${maildir}"; accounts = { hackerncoder = { primary = true; address = "${email}"; userName = "${email}"; realName = "${name}"; flavor = "plain"; passwordCommand = "${pkgs.pass}/bin/pass Email/hackerncoder"; imap = { host = "${host}"; port = 993; tls.enable = true; }; smtp = { host = "${host}"; port = 465; tls.enable = true; }; mbsync = { enable = true; create = "both"; expunge = "both"; patterns = [ "*" "!Archive" "!Archives*" ]; }; msmtp.enable = true; mu.enable = true; imapnotify = { enable = false; boxes = [ "Inbox" ]; onNotify = "${pkgs.libnotify}/bin/notify-send -u normal -i mail-unread -a 'imap-notify' 'New email' ; ${pkgs.isync}/bin/mbsync --pull --new hackerncoder:INBOX"; onNotifyPost = "${pkgs.mu}/bin/mu index"; }; }; }; }; programs = { msmtp.enable = true; mbsync.enable = true; mu.enable = true; }; services.mbsync = { enable = false; frequency = "0/3:00:00"; preExec = "${pkgs.libnotify}/bin/notify-send -u normal -i view-refresh -a 'mbsync timer' 'Syncing with mbsync'"; postExec = "${pkgs.mu}/bin/mu index"; }; services.imapnotify.enable = false; home.packages = with pkgs; [ pass mu.mu4e libnotify ]; }