nixos/home/services/email/default.nix
Evie Litherland-Smith 94c6d717b0 Use libsecret for mbsync and git-credential-helper
Add gnome-keyring as libsecret backend, swap git-credential-helper and
mbsync to using libsecret/secret-tool. Add helper script to check for
and request mbsync passwords if missing. Add GNOME Seahorse for
viewing passwords graphically.

Remove email/work.nix and merge back into default.nix

Don't auto start protonmail-bridge, use the GUI instead so it doesn't
need to unlock all my keychains immediately

Move 3D modelling software to Vanguard only, instead of all personal
devices.

Move waybar back to top of screen and adjust all corner radii to 5px
from 10px

Re-enable swayfx blur_ignore_transparent now that it's added to
nixpkgs, re-enable shadows
2024-07-08 08:58:32 +01:00

155 lines
4.3 KiB
Nix

{
config,
pkgs,
...
}: {
home.packages = with pkgs; [
protonmail-bridge-gui
(writeShellScriptBin "mbsync-ensure-pass"
(builtins.readFile ./mbsync-ensure-pass.sh))
(writeShellScriptBin "davmail-setup" ''
systemctl --user restart davmail # Ensure config file is present
systemctl --user stop davmail
${davmail}/bin/davmail -n ~/.davmail.properties
systemctl --user restart davmail
'')
];
accounts.email = {
maildirBasePath = "Mail";
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";
};
};
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";
};
};
};
};
programs = {
mu.enable = true;
msmtp.enable = true;
mbsync = {
enable = true;
groups.inboxes = {
proton = ["INBOX"];
icloud = ["INBOX"];
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"];
};
}