2023-12-26 07:42:12 +00:00
|
|
|
{ config, lib, pkgs, ... }: {
|
2023-10-10 08:29:31 +01:00
|
|
|
home.packages = with pkgs; [ davmail ];
|
2023-09-25 17:59:40 +01:00
|
|
|
accounts.email = {
|
2023-10-23 23:55:52 +01:00
|
|
|
maildirBasePath = "Mail";
|
2023-09-25 17:59:40 +01:00
|
|
|
accounts = let realName = "Evie Litherland-Smith";
|
|
|
|
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";
|
|
|
|
aliases = [ "evie@xenia.me.uk" "evie@litherlandsmith.slmail.me" ];
|
|
|
|
userName = address;
|
2023-09-30 09:27:43 +01:00
|
|
|
passwordCommand =
|
|
|
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
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";
|
2023-09-26 10:49:13 +01:00
|
|
|
patterns = [ "*" "!All Mail" "!Spam" "!Labels*" "!Starred" ];
|
2023-09-25 17:59:40 +01:00
|
|
|
subFolders = "Verbatim";
|
|
|
|
extraConfig.account.AuthMechs = "LOGIN";
|
|
|
|
};
|
|
|
|
msmtp = {
|
2023-10-01 12:04:09 +01:00
|
|
|
enable = lib.mkDefault accountEnabled;
|
2023-09-25 17:59:40 +01:00
|
|
|
extraConfig = {
|
|
|
|
tls = "off";
|
|
|
|
auth = "login";
|
|
|
|
};
|
|
|
|
};
|
2023-10-31 07:12:55 +00:00
|
|
|
mu.enable = lib.mkDefault accountEnabled;
|
2023-12-26 07:24:56 +00:00
|
|
|
neomutt.enable = lib.mkDefault accountEnabled;
|
2023-09-25 17:59:40 +01:00
|
|
|
};
|
2023-10-01 12:04:09 +01:00
|
|
|
icloud = let accountEnabled = true;
|
|
|
|
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;
|
2023-09-30 09:27:43 +01:00
|
|
|
passwordCommand =
|
|
|
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
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";
|
|
|
|
patterns = [ "*" "!Junk" ];
|
|
|
|
subFolders = "Verbatim";
|
|
|
|
};
|
2023-10-01 12:04:09 +01:00
|
|
|
msmtp.enable = lib.mkDefault accountEnabled;
|
2023-10-31 07:12:55 +00:00
|
|
|
mu.enable = lib.mkDefault accountEnabled;
|
2023-12-26 07:24:56 +00:00
|
|
|
neomutt.enable = lib.mkDefault accountEnabled;
|
2023-09-25 17:59:40 +01:00
|
|
|
};
|
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";
|
|
|
|
aliases = [ "elitherl@jet.uk" ];
|
|
|
|
userName = address;
|
2023-09-30 09:27:43 +01:00
|
|
|
passwordCommand =
|
|
|
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
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"
|
|
|
|
"!Junk"
|
|
|
|
"!Snoozed"
|
|
|
|
"!Social Activity Notifications"
|
|
|
|
"!Sync Issues"
|
|
|
|
"!Unsent Messages"
|
|
|
|
];
|
2023-09-29 09:55:52 +01:00
|
|
|
subFolders = "Verbatim";
|
|
|
|
extraConfig.account.AuthMechs = "LOGIN";
|
|
|
|
};
|
2023-10-03 09:24:43 +01:00
|
|
|
msmtp = {
|
2023-10-01 12:04:09 +01:00
|
|
|
enable = lib.mkDefault accountEnabled;
|
2023-10-03 09:24:43 +01:00
|
|
|
extraConfig = {
|
|
|
|
tls = "off";
|
|
|
|
auth = "login";
|
|
|
|
};
|
2023-09-29 09:55:52 +01:00
|
|
|
};
|
2023-10-31 07:12:55 +00:00
|
|
|
mu.enable = lib.mkDefault accountEnabled;
|
2023-12-26 07:24:56 +00:00
|
|
|
neomutt.enable = lib.mkDefault accountEnabled;
|
2023-09-29 09:55:52 +01:00
|
|
|
};
|
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 = {
|
|
|
|
proton = [ "INBOX" ];
|
|
|
|
icloud = [ "INBOX" ];
|
|
|
|
outlook = [ "INBOX" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
neomutt = {
|
|
|
|
enable = true;
|
|
|
|
checkStatsInterval = 60;
|
|
|
|
sidebar.enable = true;
|
|
|
|
extraConfig = ''
|
|
|
|
color normal default default # Text is "Text"
|
|
|
|
color index color2 default ~N # New Messages are Green
|
|
|
|
color index color1 default ~F # Flagged messages are Red
|
|
|
|
color index color13 default ~T # Tagged Messages are Red
|
|
|
|
color index color1 default ~D # Messages to delete are Red
|
|
|
|
color attachment color5 default # Attachments are Pink
|
|
|
|
color signature color8 default # Signatures are Surface 2
|
|
|
|
color search color4 default # Highlighted results are Blue
|
|
|
|
|
|
|
|
color indicator default color8 # currently highlighted message Surface 2=Background Text=Foreground
|
|
|
|
color error color1 default # error messages are Red
|
|
|
|
color status color15 default # status line "Subtext 0"
|
|
|
|
color tree color15 default # thread tree arrows Subtext 0
|
|
|
|
color tilde color15 default # blank line padding Subtext 0
|
|
|
|
|
|
|
|
color hdrdefault color13 default # default headers Pink
|
|
|
|
color header color13 default "^From:"
|
|
|
|
color header color13 default "^Subject:"
|
|
|
|
|
|
|
|
color quoted color15 default # Subtext 0
|
|
|
|
color quoted1 color7 default # Subtext 1
|
|
|
|
color quoted2 color8 default # Surface 2
|
|
|
|
color quoted3 color0 default # Surface 1
|
|
|
|
color quoted4 color0 default
|
|
|
|
color quoted5 color0 default
|
|
|
|
|
|
|
|
color body color2 default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ # email addresses Green
|
|
|
|
color body color2 default (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ # URLs Green
|
|
|
|
color body color4 default (^|[[:space:]])\\*[^[:space:]]+\\*([[:space:]]|$) # *bold* text Blue
|
|
|
|
color body color4 default (^|[[:space:]])_[^[:space:]]+_([[:space:]]|$) # _underlined_ text Blue
|
|
|
|
color body color4 default (^|[[:space:]])/[^[:space:]]+/([[:space:]]|$) # /italic/ text Blue
|
|
|
|
|
|
|
|
color sidebar_flagged color1 default # Mailboxes with flagged mails are Red
|
|
|
|
color sidebar_new color10 default # Mailboxes with new mail are Green
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2023-12-26 07:24:56 +00:00
|
|
|
services.mbsync = {
|
|
|
|
enable = true;
|
2023-12-27 10:45:27 +00:00
|
|
|
frequency = "*:0/15"; # Every 15 minutes
|
2023-12-26 07:24:56 +00:00
|
|
|
};
|
2023-10-03 07:59:00 +01:00
|
|
|
systemd.user.services = let emailAccounts = config.accounts.email.accounts;
|
|
|
|
in {
|
|
|
|
protonmail-bridge = lib.mkIf emailAccounts.proton.mbsync.enable {
|
|
|
|
Unit = {
|
|
|
|
Description = "Podman container-protonmail-bridge.service";
|
|
|
|
Documentation = [ "man:podman-generate-systemd(1)" ];
|
|
|
|
Wants = [ "network-online.target" ];
|
|
|
|
After = [ "network-online.target" ];
|
|
|
|
RequiresMountsFor = "%t/containers";
|
2023-10-01 09:17:45 +01:00
|
|
|
};
|
2023-10-03 07:59:00 +01:00
|
|
|
Service = {
|
|
|
|
Environment =
|
|
|
|
[ "PODMAN_SYSTEMD_UNIT=%n" "PATH=/run/wrappers/bin/:$PATH" ];
|
|
|
|
Restart = "always";
|
|
|
|
TimeoutStopSec = 70;
|
|
|
|
ExecStart = ''
|
|
|
|
${pkgs.podman}/bin/podman run \
|
|
|
|
--cidfile=%t/%n.ctr-id \
|
|
|
|
--cgroups=no-conmon \
|
|
|
|
--rm \
|
|
|
|
--sdnotify=conmon \
|
|
|
|
--replace \
|
|
|
|
-d \
|
|
|
|
--name=protonmail-bridge \
|
|
|
|
-v protonmail:/root \
|
|
|
|
-p 127.0.0.1:1025:25/tcp \
|
|
|
|
-p 127.0.0.1:1143:143/tcp shenxn/protonmail-bridge'';
|
|
|
|
ExecStop = ''
|
|
|
|
${pkgs.podman}/bin/podman stop \
|
|
|
|
--ignore -t 10 \
|
|
|
|
--cidfile=%t/%n.ctr-id'';
|
|
|
|
ExecStopPost = ''
|
|
|
|
${pkgs.podman}/bin/podman rm \
|
|
|
|
-f \
|
|
|
|
--ignore -t 10 \
|
|
|
|
--cidfile=%t/%n.ctr-id'';
|
|
|
|
Type = "notify";
|
|
|
|
NotifyAccess = "all";
|
|
|
|
};
|
|
|
|
Install.WantedBy = [ "default.target" ];
|
|
|
|
};
|
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";
|
2023-10-08 15:26:47 +01:00
|
|
|
Wants = [ "network-online.target" ];
|
|
|
|
After = [ "network-online.target" ];
|
2023-10-01 09:17:45 +01:00
|
|
|
};
|
|
|
|
Service = {
|
2023-10-02 16:58:54 +01: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; ''
|
|
|
|
/bin/sh -c "if [ ! -f ${homeDirectory}/.davmail.properties ]; then cp ${
|
|
|
|
./.davmail.properties
|
2023-10-08 09:53:09 +01:00
|
|
|
} ${homeDirectory}/.davmail.properties; fi; chmod 644 ${homeDirectory}/.davmail.properties"
|
2023-10-08 09:49:07 +01:00
|
|
|
'';
|
|
|
|
ExecStart =
|
|
|
|
"${pkgs.davmail}/bin/davmail -notray ${config.home.homeDirectory}/.davmail.properties";
|
2023-10-01 09:17:45 +01:00
|
|
|
};
|
2023-10-02 06:26:54 +01:00
|
|
|
Install.WantedBy = [ "default.target" ];
|
2023-10-01 09:17:45 +01:00
|
|
|
};
|
|
|
|
};
|
2023-09-02 08:41:07 +01:00
|
|
|
}
|