nixos/programs/email.nix

68 lines
1.6 KiB
Nix
Raw Permalink Normal View History

2024-06-16 10:10:36 +00:00
{ 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";
};
msmtp.enable = true;
mu.enable = true;
imapnotify = {
enable = true;
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 = true;
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 = true;
home.packages = with pkgs; [
pass
mu.mu4e
libnotify
];
}