2024-01-30 14:21:50 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
hostName,
|
|
|
|
...
|
|
|
|
}: {
|
2023-09-25 17:59:40 +01:00
|
|
|
accounts.email = {
|
2023-10-23 23:55:52 +01:00
|
|
|
maildirBasePath = "Mail";
|
2024-01-30 14:21:50 +00:00
|
|
|
accounts = let
|
|
|
|
realName = "Evie Litherland-Smith";
|
2023-09-25 17:59:40 +01:00
|
|
|
in {
|
|
|
|
proton = let
|
|
|
|
host = "127.0.0.1";
|
|
|
|
tls.enable = false;
|
2023-10-01 12:04:09 +01:00
|
|
|
accountEnabled = true;
|
2023-09-25 17:59:40 +01:00
|
|
|
in rec {
|
|
|
|
inherit realName;
|
2023-10-01 11:40:47 +01:00
|
|
|
primary = lib.mkDefault true;
|
2023-09-25 17:59:40 +01:00
|
|
|
maildir.path = "Proton";
|
|
|
|
imap = {
|
|
|
|
inherit host tls;
|
|
|
|
port = 1143;
|
|
|
|
};
|
|
|
|
smtp = {
|
|
|
|
inherit host tls;
|
|
|
|
port = 1025;
|
|
|
|
};
|
|
|
|
address = "e.litherlandsmith@proton.me";
|
2024-01-30 14:21:50 +00:00
|
|
|
aliases = ["evie@xenia.me.uk" "evie@litherlandsmith.slmail.me"];
|
2023-09-25 17:59:40 +01:00
|
|
|
userName = address;
|
2024-01-30 14:21:50 +00:00
|
|
|
passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostName}/proton | head -n1";
|
2024-02-29 14:16:34 +00:00
|
|
|
mu.enable = lib.mkDefault accountEnabled;
|
|
|
|
msmtp = {
|
|
|
|
enable = lib.mkDefault accountEnabled;
|
|
|
|
extraConfig = {
|
|
|
|
tls = "off";
|
|
|
|
auth = "login";
|
|
|
|
};
|
|
|
|
};
|
2023-09-25 17:59:40 +01:00
|
|
|
mbsync = {
|
2023-10-01 12:04:09 +01:00
|
|
|
enable = lib.mkDefault accountEnabled;
|
2023-09-25 17:59:40 +01:00
|
|
|
create = "both";
|
|
|
|
expunge = "both";
|
|
|
|
remove = "both";
|
2024-01-30 14:21:50 +00:00
|
|
|
patterns = ["*" "!All Mail" "!Labels*" "!Starred" "!Recovered Messages"];
|
2023-09-25 17:59:40 +01:00
|
|
|
subFolders = "Verbatim";
|
|
|
|
extraConfig.account.AuthMechs = "LOGIN";
|
|
|
|
};
|
|
|
|
};
|
2024-01-30 14:21:50 +00:00
|
|
|
icloud = let
|
|
|
|
accountEnabled = true;
|
2023-10-01 12:04:09 +01:00
|
|
|
in rec {
|
2023-09-25 17:59:40 +01:00
|
|
|
inherit realName;
|
2023-10-15 10:02:16 +01:00
|
|
|
primary = lib.mkDefault false;
|
2023-09-25 17:59:40 +01:00
|
|
|
maildir.path = "iCloud";
|
|
|
|
imap.host = "imap.mail.me.com";
|
|
|
|
smtp.host = "smtp.mail.me.com";
|
|
|
|
address = "e.litherlandsmith@icloud.com";
|
|
|
|
userName = address;
|
2024-01-30 14:21:50 +00:00
|
|
|
passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostName}/icloud | head -n1";
|
2024-02-29 14:16:34 +00:00
|
|
|
mu.enable = lib.mkDefault accountEnabled;
|
|
|
|
msmtp.enable = lib.mkDefault accountEnabled;
|
2023-09-25 17:59:40 +01:00
|
|
|
mbsync = {
|
2023-10-01 12:04:09 +01:00
|
|
|
enable = lib.mkDefault accountEnabled;
|
2023-09-25 17:59:40 +01:00
|
|
|
create = "both";
|
|
|
|
expunge = "both";
|
|
|
|
remove = "both";
|
2024-01-30 14:21:50 +00:00
|
|
|
patterns = ["*" "!Notes"];
|
2023-09-25 17:59:40 +01:00
|
|
|
subFolders = "Verbatim";
|
|
|
|
};
|
|
|
|
};
|
2023-10-15 10:02:16 +01:00
|
|
|
outlook = let
|
2023-09-29 09:55:52 +01:00
|
|
|
host = "127.0.0.1";
|
|
|
|
tls.enable = false;
|
2023-10-04 09:53:38 +01:00
|
|
|
accountEnabled = true;
|
2023-09-29 09:55:52 +01:00
|
|
|
in rec {
|
|
|
|
inherit realName;
|
|
|
|
primary = lib.mkDefault false;
|
2023-10-15 10:02:16 +01:00
|
|
|
maildir.path = "Outlook";
|
2023-09-29 09:55:52 +01:00
|
|
|
imap = {
|
|
|
|
inherit host tls;
|
|
|
|
port = 1144;
|
|
|
|
};
|
|
|
|
smtp = {
|
|
|
|
inherit host tls;
|
|
|
|
port = 1026;
|
|
|
|
};
|
|
|
|
address = "evie.litherland-smith@ukaea.uk";
|
2024-01-30 14:21:50 +00:00
|
|
|
aliases = ["elitherl@jet.uk"];
|
2023-09-29 09:55:52 +01:00
|
|
|
userName = address;
|
2024-01-30 14:21:50 +00:00
|
|
|
passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostName}/outlook | head -n1";
|
2024-02-29 14:16:34 +00:00
|
|
|
mu.enable = lib.mkDefault accountEnabled;
|
|
|
|
msmtp = {
|
|
|
|
enable = lib.mkDefault accountEnabled;
|
|
|
|
extraConfig = {
|
|
|
|
tls = "off";
|
|
|
|
auth = "login";
|
|
|
|
};
|
|
|
|
};
|
2023-09-29 09:55:52 +01:00
|
|
|
mbsync = {
|
2023-10-01 12:04:09 +01:00
|
|
|
enable = lib.mkDefault accountEnabled;
|
2023-09-29 09:55:52 +01:00
|
|
|
create = "both";
|
|
|
|
expunge = "both";
|
|
|
|
remove = "both";
|
2023-10-25 10:01:40 +01:00
|
|
|
patterns = [
|
|
|
|
"*"
|
|
|
|
"!Conversation History"
|
|
|
|
"!Snoozed"
|
|
|
|
"!Social Activity Notifications"
|
2024-01-19 06:36:43 +00:00
|
|
|
"!Sync Issues*"
|
2023-10-25 10:01:40 +01:00
|
|
|
"!Unsent Messages"
|
|
|
|
];
|
2023-09-29 09:55:52 +01:00
|
|
|
subFolders = "Verbatim";
|
|
|
|
extraConfig.account.AuthMechs = "LOGIN";
|
|
|
|
};
|
|
|
|
};
|
2023-09-25 17:59:40 +01:00
|
|
|
};
|
2023-09-02 08:41:07 +01:00
|
|
|
};
|
2023-12-26 07:42:12 +00:00
|
|
|
programs = {
|
|
|
|
mu.enable = true;
|
|
|
|
msmtp.enable = true;
|
|
|
|
mbsync = {
|
|
|
|
enable = true;
|
|
|
|
groups.inboxes = {
|
2024-01-30 14:21:50 +00:00
|
|
|
proton = ["INBOX"];
|
|
|
|
icloud = ["INBOX"];
|
|
|
|
outlook = ["INBOX"];
|
2023-12-26 07:42:12 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-01-30 14:21:50 +00:00
|
|
|
systemd.user.services = let
|
|
|
|
emailAccounts = config.accounts.email.accounts;
|
2023-10-03 07:59:00 +01:00
|
|
|
in {
|
2023-10-15 10:02:16 +01:00
|
|
|
davmail = lib.mkIf emailAccounts.outlook.mbsync.enable {
|
2023-10-01 09:17:45 +01:00
|
|
|
Unit = {
|
2023-10-02 16:58:54 +01:00
|
|
|
Description = "Davmail server";
|
2024-01-30 14:21:50 +00:00
|
|
|
Wants = ["network-online.target"];
|
|
|
|
After = ["network-online.target"];
|
2023-10-01 09:17:45 +01:00
|
|
|
};
|
|
|
|
Service = {
|
2024-01-30 14:21:50 +00:00
|
|
|
Environment = ["PATH=/run/current-system/sw/bin/:$PATH"];
|
2023-10-01 09:17:45 +01:00
|
|
|
Restart = "always";
|
2023-10-08 09:49:07 +01:00
|
|
|
ExecStartPre = with config.home; ''
|
2024-01-30 14:21:50 +00:00
|
|
|
/bin/sh -c "if [ ! -f ${homeDirectory}/.davmail.properties ]; then cp ${./.davmail.properties} ${homeDirectory}/.davmail.properties; fi; chmod 644 ${homeDirectory}/.davmail.properties"
|
2023-10-08 09:49:07 +01:00
|
|
|
'';
|
2024-01-30 14:21:50 +00:00
|
|
|
ExecStart = "${pkgs.davmail}/bin/davmail -notray ${config.home.homeDirectory}/.davmail.properties";
|
2023-10-01 09:17:45 +01:00
|
|
|
};
|
2024-01-30 14:21:50 +00:00
|
|
|
Install.WantedBy = ["default.target"];
|
2023-10-01 09:17:45 +01:00
|
|
|
};
|
|
|
|
};
|
2023-09-02 08:41:07 +01:00
|
|
|
}
|