This repository has been archived on 2024-07-03. You can view files and clone it, but cannot push or open issues or pull requests.
home-manager/services/email/work.nix

70 lines
1.8 KiB
Nix
Raw Normal View History

{
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"];
};
}