nixos/home/email/work.nix
Evie Litherland-Smith 6aae3e131f Fix accidentally disabling work email on work machines...
Move work email config to separate work.nix file in email directory,
remove the if block dependencies on mu status since that doesn't get
update if mu.enable is changed in another file!
2024-03-11 15:35:01 +00:00

70 lines
1.8 KiB
Nix

{
config,
pkgs,
hostName,
...
}: {
imports = [./default.nix];
accounts.email.accounts.outlook = let
host = "127.0.0.1";
tls.enable = false;
in rec {
inherit (config.accounts.email.accounts.proton) realName;
primary = false;
maildir.path = "Outlook";
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.pass}/bin/pass show mbsync/${hostName}/outlook | head -n1";
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";
};
};
programs.mbsync.groups.inboxes.outlook = ["INBOX"];
systemd.user.services.davmail = {
Unit = {
Description = "Davmail server";
Wants = ["network-online.target"];
After = ["network-online.target"];
};
Service = {
Environment = ["PATH=/run/current-system/sw/bin/:$PATH"];
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";
};
Install.WantedBy = ["default.target"];
};
}