2021-09-10 11:43:08 +00:00
|
|
|
{ config, lib, pkgs, nixosConfig, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
params = import ../../../secrets/email.nix;
|
|
|
|
realName = nixosConfig.users.users.jez.description;
|
|
|
|
in {
|
|
|
|
accounts.email.accounts.main = rec {
|
2022-09-26 13:57:49 +00:00
|
|
|
#primary = true;
|
2021-09-10 11:43:08 +00:00
|
|
|
inherit realName;
|
|
|
|
inherit (params.main) address userName passwordCommand aliases;
|
|
|
|
|
|
|
|
imap = {
|
|
|
|
inherit (params.main) host;
|
|
|
|
tls.useStartTls = true;
|
|
|
|
};
|
2021-09-11 20:00:31 +00:00
|
|
|
smtp = {
|
|
|
|
inherit (params.main) host;
|
|
|
|
port = 587;
|
|
|
|
tls.useStartTls = true;
|
|
|
|
};
|
|
|
|
|
2021-09-10 11:43:08 +00:00
|
|
|
mu.enable = true;
|
|
|
|
mbsync = {
|
|
|
|
enable = true;
|
|
|
|
create = "both";
|
2021-09-16 11:07:52 +00:00
|
|
|
remove = "both";
|
2021-09-11 12:54:40 +00:00
|
|
|
expunge = "both";
|
2021-09-10 11:43:08 +00:00
|
|
|
flatten = ".";
|
|
|
|
patterns = [ "*" ];
|
|
|
|
};
|
2021-09-11 20:00:31 +00:00
|
|
|
msmtp.enable = true;
|
2021-09-10 11:43:08 +00:00
|
|
|
};
|
|
|
|
|
2022-09-26 13:57:49 +00:00
|
|
|
accounts.email.accounts.fm = rec {
|
|
|
|
primary = true;
|
|
|
|
inherit realName;
|
|
|
|
inherit (params.fm) address userName passwordCommand aliases;
|
|
|
|
|
|
|
|
imap = { host = params.fm.host.imap; };
|
|
|
|
smtp = { host = params.fm.host.smtp; };
|
|
|
|
|
|
|
|
mu.enable = true;
|
|
|
|
mbsync = {
|
|
|
|
enable = true;
|
|
|
|
create = "both";
|
|
|
|
remove = "both";
|
|
|
|
expunge = "both";
|
|
|
|
flatten = ".";
|
|
|
|
patterns = [ "*" ];
|
|
|
|
extraConfig.channel = { CopyArrivalDate = "yes"; };
|
|
|
|
};
|
|
|
|
msmtp.enable = true;
|
|
|
|
};
|
|
|
|
|
2021-09-10 11:43:08 +00:00
|
|
|
accounts.email.accounts.protonmail = rec {
|
|
|
|
inherit realName;
|
|
|
|
inherit (params.protonmail) address userName passwordCommand;
|
|
|
|
|
|
|
|
imap = {
|
|
|
|
host = "127.0.0.1";
|
|
|
|
port = 1143;
|
|
|
|
tls.enable = false;
|
|
|
|
};
|
|
|
|
mbsync = {
|
|
|
|
enable = false;
|
|
|
|
create = "maildir";
|
|
|
|
flatten = ".";
|
|
|
|
patterns = [ "INBOX" "Sent" "All Mail" ];
|
|
|
|
extraConfig.account = { Timeout = 300; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
programs.mu.enable = true;
|
2021-09-16 11:08:10 +00:00
|
|
|
programs.zsh.initExtra = ''
|
|
|
|
function mu-archive {
|
|
|
|
mu "$@" --muhome ~/Archive/Mail/mu
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2021-09-11 20:00:31 +00:00
|
|
|
programs.msmtp.enable = true;
|
2021-09-10 11:43:08 +00:00
|
|
|
|
|
|
|
programs.mbsync.enable = true;
|
|
|
|
services.mbsync = {
|
|
|
|
enable = true;
|
2021-09-13 13:50:37 +00:00
|
|
|
postExec = "${pkgs.bash}/bin/bash -c '${pkgs.mu}/bin/mu index || true'";
|
2021-09-10 11:43:08 +00:00
|
|
|
};
|
|
|
|
}
|