188 lines
5.3 KiB
Nix
188 lines
5.3 KiB
Nix
{ config, lib, pkgs, hostName, ... }:
|
|
|
|
{
|
|
programs = {
|
|
mbsync = {
|
|
enable = true;
|
|
groups.inboxes = {
|
|
proton = [ "INBOX" ];
|
|
icloud = [ "INBOX" ];
|
|
};
|
|
};
|
|
msmtp.enable = true;
|
|
mu.enable = true;
|
|
};
|
|
services = {
|
|
mbsync = {
|
|
enable = true;
|
|
frequency = "*:0/15";
|
|
};
|
|
imapnotify.enable = true;
|
|
};
|
|
accounts.email = {
|
|
maildirBasePath = ".mail";
|
|
accounts = let realName = "Evie Litherland-Smith";
|
|
in {
|
|
proton = let
|
|
host = "127.0.0.1";
|
|
tls.enable = false;
|
|
in rec {
|
|
inherit realName;
|
|
primary = lib.mkDefault false; # TEMP until fixed
|
|
maildir.path = "Proton";
|
|
imap = {
|
|
inherit host tls;
|
|
port = 1143;
|
|
};
|
|
smtp = {
|
|
inherit host tls;
|
|
port = 1025;
|
|
};
|
|
address = "e.litherlandsmith@proton.me";
|
|
aliases = [ "evie@xenia.me.uk" "evie@litherlandsmith.slmail.me" ];
|
|
userName = address;
|
|
passwordCommand =
|
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
|
imapnotify = {
|
|
enable = false; # TEMP until fixed
|
|
boxes = [ "INBOX" ];
|
|
onNotify = "${pkgs.isync}/bin/mbsync --pull proton:INBOX";
|
|
onNotifyPost =
|
|
"${pkgs.libnotify}/bin/notify-send 'Proton: New mail arrived'";
|
|
extraConfig = {
|
|
wait = 300;
|
|
tls = false;
|
|
tlsOptions.rejectUnauthorized = false;
|
|
};
|
|
};
|
|
mbsync = {
|
|
enable = false; # TEMP until fixed
|
|
create = "both";
|
|
expunge = "both";
|
|
remove = "both";
|
|
patterns = [ "*" "!All Mail" "!Spam" "!Labels*" "!Starred" ];
|
|
subFolders = "Verbatim";
|
|
extraConfig.account.AuthMechs = "LOGIN";
|
|
};
|
|
msmtp = {
|
|
enable = false; # TEMP until fixed
|
|
extraConfig = {
|
|
tls = "off";
|
|
auth = "login";
|
|
};
|
|
};
|
|
mu.enable = false; # TEMP until fixed
|
|
};
|
|
icloud = rec {
|
|
inherit realName;
|
|
primary = lib.mkDefault true; # TEMP until proton is fixed
|
|
maildir.path = "iCloud";
|
|
imap.host = "imap.mail.me.com";
|
|
smtp.host = "smtp.mail.me.com";
|
|
address = "e.litherlandsmith@icloud.com";
|
|
userName = address;
|
|
passwordCommand =
|
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
|
imapnotify = {
|
|
enable = true;
|
|
boxes = [ "INBOX" ];
|
|
onNotify = "${pkgs.isync}/bin/mbsync --pull icloud:INBOX";
|
|
onNotifyPost =
|
|
"${pkgs.libnotify}/bin/notify-send 'Proton: New mail arrived'";
|
|
extraConfig.wait = 300;
|
|
};
|
|
mbsync = {
|
|
enable = true;
|
|
create = "both";
|
|
expunge = "both";
|
|
remove = "both";
|
|
patterns = [ "*" "!Junk" ];
|
|
subFolders = "Verbatim";
|
|
};
|
|
msmtp.enable = true;
|
|
mu.enable = true;
|
|
};
|
|
ukaea = let
|
|
host = "127.0.0.1";
|
|
tls.enable = false;
|
|
in rec {
|
|
inherit realName;
|
|
primary = lib.mkDefault false;
|
|
maildir.path = "UKAEA";
|
|
imap = {
|
|
inherit host tls;
|
|
port = 1144;
|
|
};
|
|
smtp = {
|
|
inherit host tls;
|
|
port = 1026;
|
|
};
|
|
address = "evie.litherland-smith@ukaea.uk";
|
|
aliases = [ "elitherl@jet.uk" ];
|
|
userName = address;
|
|
passwordCommand =
|
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
|
imapnotify = {
|
|
boxes = [ "INBOX" ];
|
|
onNotify = "${pkgs.isync}/bin/mbsync --pull ukaea:INBOX";
|
|
onNotifyPost =
|
|
"${pkgs.libnotify}/bin/notify-send 'Proton: New mail arrived'";
|
|
extraConfig = {
|
|
wait = 300;
|
|
tls = false;
|
|
tlsOptions.rejectUnauthorized = false;
|
|
};
|
|
};
|
|
mbsync = {
|
|
create = "both";
|
|
expunge = "both";
|
|
remove = "both";
|
|
patterns =
|
|
[ "*" "!Junk" "!Snoozed" "!Sync Issues" "!Unsent Messages" ];
|
|
subFolders = "Verbatim";
|
|
extraConfig.account.AuthMechs = "LOGIN";
|
|
};
|
|
msmtp.extraConfig = {
|
|
tls = "off";
|
|
auth = "login";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
systemd.user.services = {
|
|
protonmail-bridge =
|
|
lib.mkIf config.accounts.email.accounts.proton.mbsync.enable {
|
|
Unit = {
|
|
Description = "Protonmail Bridge";
|
|
After = [ "network.target" ];
|
|
};
|
|
Service = {
|
|
Restart = "always";
|
|
# Environment = "PATH=${pkgs.libsecret}/bin";
|
|
ExecStart =
|
|
"${pkgs.protonmail-bridge}/bin/protonmail-bridge --noninteractive --log-level info";
|
|
};
|
|
Install.WantedBy = [
|
|
"graphical-session.target"
|
|
"mbsync.service"
|
|
"imapnotify-proton.service"
|
|
];
|
|
};
|
|
davmail = lib.mkIf config.accounts.email.accounts.ukaea.mbsync.enable {
|
|
Unit = {
|
|
Description = "DavMail";
|
|
After = [ "network.target" ];
|
|
};
|
|
Service = {
|
|
Restart = "always";
|
|
ExecStart = "${pkgs.davmail}/bin/davmail -notray";
|
|
};
|
|
Install.WantedBy = [
|
|
"graphical-session.target"
|
|
"mbsync.service"
|
|
"imapnotify-ukaea.service"
|
|
];
|
|
};
|
|
};
|
|
}
|