From 3fe286c2a0212dcd3217ab42f238974e1f96b78c Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Thu, 14 Sep 2023 08:30:55 +0100 Subject: [PATCH] Add email accounts properly using nix Switch to notmuch instead of mu due to mu/mu4e nix weirdness --- home/accounts/default.nix | 106 ++++++++++++++++++++++++++++++++++---- home/accounts/service.nix | 8 +-- 2 files changed, 100 insertions(+), 14 deletions(-) diff --git a/home/accounts/default.nix b/home/accounts/default.nix index 8d817844..154a57c9 100644 --- a/home/accounts/default.nix +++ b/home/accounts/default.nix @@ -1,19 +1,105 @@ { pkgs, hostName, ... }: { - # accounts.emails.accounts = {}; # TODO + accounts.email.accounts = let + realName = "Evelyn Litherland-Smith"; + notmuch.enable = true; + + in { + proton = let + host = "127.0.0.1"; + tls.enable = false; + in rec { + inherit realName notmuch; + 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" ]; + passwordCommand = "${pkgs.pass}/bin/pass show Mail/Proton/${hostName}"; + primary = true; + userName = address; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + subFolders = "Verbatim"; + extraConfig.account.AuthMechs = "LOGIN"; + }; + msmtp = { + enable = true; + extraConfig = { + tls = "off"; + auth = "login"; + }; + }; + }; + icloud = rec { + inherit realName notmuch; + maildir.path = "iCloud"; + imap.host = "imap.mail.me.com"; + smtp.host = "smtp.mail.me.com"; + address = "e.litherlandsmith@icloud.com"; + passwordCommand = "${pkgs.pass}/bin/pass show Mail/iCloud/mbsync"; + userName = address; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + subFolders = "Verbatim"; + }; + msmtp.enable = true; + }; + ukaea = let + host = "127.0.0.1"; + tls.enable = false; + in rec { + inherit realName notmuch; + maildir.path = "UKAEA"; + imap = { + inherit host tls; + port = 1144; + }; + smtp = { + inherit host tls; + port = 1026; + }; + address = "evie.litherland-smith@ukaea.uk"; + passwordCommand = "${pkgs.pass}/bin/pass show Mail/Outlook/ukaea"; + userName = address; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + subFolders = "Verbatim"; + extraConfig.account.AuthMechs = "LOGIN"; + }; + msmtp = { + enable = true; + extraConfig = { + tls = "off"; + auth = "login"; + }; + }; + }; + }; home.packages = with pkgs; [ protonmail-bridge davmail vdirsyncer ]; programs = { - mu.enable = true; - mbsync = { - enable = true; - extraConfig = import ./config/mbsync.nix { inherit pkgs hostName; }; - }; - msmtp = { - enable = true; - extraConfig = import ./config/msmtp.nix { inherit pkgs hostName; }; - }; + mbsync = { enable = true; }; + msmtp = { enable = true; }; # vdirsyncer = { enable = true; }; + notmuch = { + enable = true; + maildir.synchronizeFlags = true; + }; + afew.enable = true; + alot.enable = true; }; xdg.configFile."vdirsyncer/config".text = import ./config/vdirsyncer.nix { inherit pkgs; }; diff --git a/home/accounts/service.nix b/home/accounts/service.nix index 509ab985..71ab577d 100644 --- a/home/accounts/service.nix +++ b/home/accounts/service.nix @@ -2,8 +2,8 @@ { imports = [ ./default.nix ]; - services.mbsync = { - enable = true; - frequency = "*-*-* *:0/15:00"; - }; + # services.mbsync = { + # enable = true; + # frequency = "*-*-* *:0/15:00"; + # }; }