2024-07-30 15:06:34 +01:00
|
|
|
{ config, pkgs, ... }:
|
2024-07-03 07:15:39 +01:00
|
|
|
{
|
2024-08-28 08:23:16 +01:00
|
|
|
home.packages = [
|
|
|
|
(pkgs.writeShellScriptBin "mbsync-ensure-pass" (builtins.readFile ./mbsync-ensure-pass.sh))
|
|
|
|
(pkgs.writeShellScriptBin "davmail-setup" ''
|
2024-07-08 08:58:32 +01:00
|
|
|
systemctl --user restart davmail # Ensure config file is present
|
|
|
|
systemctl --user stop davmail
|
2024-08-28 08:23:16 +01:00
|
|
|
${pkgs.davmail}/bin/davmail -n ~/.davmail.properties
|
2024-07-08 08:58:32 +01:00
|
|
|
systemctl --user restart davmail
|
|
|
|
'')
|
|
|
|
];
|
2024-07-03 07:15:39 +01:00
|
|
|
accounts.email = {
|
|
|
|
maildirBasePath = "Mail";
|
2024-07-30 15:06:34 +01:00
|
|
|
accounts =
|
|
|
|
let
|
|
|
|
realName = "Evie Litherland-Smith";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
proton =
|
|
|
|
let
|
|
|
|
address = "e.litherlandsmith@proton.me";
|
|
|
|
host = "127.0.0.1";
|
|
|
|
tls.enable = false;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit realName address;
|
|
|
|
primary = true;
|
|
|
|
maildir.path = "Proton";
|
|
|
|
imap = {
|
|
|
|
inherit host tls;
|
|
|
|
port = 1143;
|
|
|
|
};
|
|
|
|
smtp = {
|
|
|
|
inherit host tls;
|
|
|
|
port = 1025;
|
|
|
|
};
|
|
|
|
aliases = [
|
|
|
|
"evie@xenia.me.uk"
|
|
|
|
"evie@litherlandsmith.slmail.me"
|
|
|
|
];
|
|
|
|
userName = address;
|
|
|
|
passwordCommand = "${pkgs.libsecret}/bin/secret-tool lookup email ${address}";
|
|
|
|
mu.enable = true;
|
|
|
|
msmtp = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = {
|
|
|
|
tls = "off";
|
|
|
|
auth = "login";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
mbsync = {
|
|
|
|
enable = true;
|
|
|
|
create = "both";
|
|
|
|
expunge = "both";
|
|
|
|
remove = "both";
|
|
|
|
patterns = [
|
|
|
|
"*"
|
|
|
|
"!All Mail"
|
|
|
|
"!Labels*"
|
|
|
|
"!Starred"
|
|
|
|
"!Recovered Messages"
|
|
|
|
];
|
|
|
|
subFolders = "Verbatim";
|
|
|
|
extraConfig.account.AuthMechs = "LOGIN";
|
|
|
|
};
|
2024-07-03 07:15:39 +01:00
|
|
|
};
|
2024-07-30 15:06:34 +01:00
|
|
|
icloud =
|
|
|
|
let
|
|
|
|
address = "e.litherlandsmith@icloud.com";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit realName address;
|
|
|
|
primary = false;
|
|
|
|
maildir.path = "iCloud";
|
|
|
|
imap.host = "imap.mail.me.com";
|
|
|
|
smtp.host = "smtp.mail.me.com";
|
|
|
|
userName = address;
|
|
|
|
passwordCommand = "${pkgs.libsecret}/bin/secret-tool lookup email ${address}";
|
|
|
|
mu.enable = true;
|
|
|
|
msmtp.enable = true;
|
|
|
|
mbsync = {
|
|
|
|
enable = true;
|
|
|
|
create = "both";
|
|
|
|
expunge = "both";
|
|
|
|
remove = "both";
|
|
|
|
patterns = [
|
|
|
|
"*"
|
|
|
|
"!Notes"
|
|
|
|
];
|
|
|
|
subFolders = "Verbatim";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
outlook =
|
|
|
|
let
|
|
|
|
address = "evie.litherland-smith@ukaea.uk";
|
|
|
|
host = "127.0.0.1";
|
|
|
|
tls.enable = false;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit realName address;
|
|
|
|
primary = false;
|
|
|
|
maildir.path = "Outlook";
|
|
|
|
imap = {
|
|
|
|
inherit host tls;
|
|
|
|
port = 1144;
|
|
|
|
};
|
|
|
|
smtp = {
|
|
|
|
inherit host tls;
|
|
|
|
port = 1026;
|
|
|
|
};
|
|
|
|
aliases = [ "elitherl@jet.uk" ];
|
|
|
|
userName = address;
|
|
|
|
passwordCommand = "${pkgs.libsecret}/bin/secret-tool lookup email ${address}";
|
|
|
|
mu.enable = true;
|
|
|
|
msmtp = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = {
|
|
|
|
tls = "off";
|
|
|
|
auth = "login";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
mbsync = {
|
|
|
|
enable = true;
|
|
|
|
create = "both";
|
|
|
|
expunge = "both";
|
|
|
|
remove = "both";
|
|
|
|
patterns = [
|
|
|
|
"*"
|
|
|
|
"!Conversation History"
|
|
|
|
"!Snoozed"
|
|
|
|
"!Social Activity Notifications"
|
|
|
|
"!Sync Issues*"
|
|
|
|
"!Unsent Messages"
|
|
|
|
];
|
|
|
|
subFolders = "Verbatim";
|
|
|
|
extraConfig.account.AuthMechs = "LOGIN";
|
|
|
|
};
|
2024-07-08 08:58:32 +01:00
|
|
|
};
|
|
|
|
};
|
2024-07-03 07:15:39 +01:00
|
|
|
};
|
|
|
|
programs = {
|
|
|
|
mu.enable = true;
|
|
|
|
msmtp.enable = true;
|
|
|
|
mbsync = {
|
|
|
|
enable = true;
|
|
|
|
groups.inboxes = {
|
2024-07-30 15:06:34 +01:00
|
|
|
proton = [ "INBOX" ];
|
|
|
|
icloud = [ "INBOX" ];
|
|
|
|
outlook = [ "INBOX" ];
|
2024-07-03 07:15:39 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-08-28 08:23:16 +01:00
|
|
|
services.mbsync = {
|
|
|
|
inherit (config.programs.mbsync) enable package;
|
2024-10-13 13:27:40 +01:00
|
|
|
frequency = "*:0/30"; # Every 30 minutes
|
2024-08-28 08:23:16 +01:00
|
|
|
verbose = true;
|
|
|
|
preExec = null;
|
|
|
|
postExec = null;
|
|
|
|
};
|
2024-07-08 08:58:32 +01:00
|
|
|
systemd.user.services.davmail = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Davmail server";
|
2024-07-30 15:06:34 +01:00
|
|
|
Wants = [ "network-online.target" ];
|
|
|
|
After = [ "network-online.target" ];
|
2024-07-08 08:58:32 +01:00
|
|
|
};
|
|
|
|
Service = {
|
2024-07-30 15:06:34 +01:00
|
|
|
Environment = [ "PATH=/run/current-system/sw/bin/:$PATH" ];
|
2024-07-08 08:58:32 +01:00
|
|
|
Restart = "always";
|
|
|
|
ExecStartPre = with config.home; ''
|
|
|
|
/bin/sh -c "if [ ! -f ${homeDirectory}/.davmail.properties ]; then cp ${./davmail.properties} ${homeDirectory}/.davmail.properties; fi; chmod 644 ${homeDirectory}/.davmail.properties"
|
|
|
|
'';
|
|
|
|
ExecStart = "${pkgs.davmail}/bin/davmail -notray ${config.home.homeDirectory}/.davmail.properties";
|
|
|
|
};
|
2024-07-30 15:06:34 +01:00
|
|
|
Install.WantedBy = [ "default.target" ];
|
2024-07-08 08:58:32 +01:00
|
|
|
};
|
2024-07-03 07:15:39 +01:00
|
|
|
}
|