From 09de275af1e577575aa202eecd5c5357a85b4d82 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Fri, 1 Sep 2023 15:18:29 +0100 Subject: [PATCH] Initial setup of mbsync and msmtp in home-manager --- flake.nix | 5 +- home/emacs/default.nix | 9 +-- home/mail/default.nix | 157 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 10 deletions(-) create mode 100644 home/mail/default.nix diff --git a/flake.nix b/flake.nix index f23d5370..b90dd26e 100644 --- a/flake.nix +++ b/flake.nix @@ -62,7 +62,8 @@ useGlobalPkgs = true; useUserPackages = false; extraSpecialArgs = { - inherit user hyprland anyrun wallpapers tokyonight; + inherit hostName user shell hyprland anyrun wallpapers + tokyonight; shellConfig = ./home/shell/${shell}.nix; }; users.${user} = import ./hosts/${hostName}/home.nix; @@ -74,7 +75,7 @@ home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; extraSpecialArgs = { - inherit user shell hyprland anyrun wallpapers tokyonight; + inherit hostName user shell hyprland anyrun wallpapers tokyonight; shellConfig = ./home/shell/${shell}.nix; }; modules = [ ./hosts/${hostName}/home.nix ]; diff --git a/home/emacs/default.nix b/home/emacs/default.nix index f5927155..1d1a0a81 100644 --- a/home/emacs/default.nix +++ b/home/emacs/default.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { - imports = [ ../git/default.nix ]; + imports = [ ../git/default.nix ../mail/default.nix ]; programs.emacs.enable = true; home.packages = with pkgs; [ # Emacs dependencies @@ -11,13 +11,6 @@ fd graphviz - # Mail server setup - isync - mu - msmtp - protonmail-bridge - davmail - # Language-specific requirements ispell findutils diff --git a/home/mail/default.nix b/home/mail/default.nix new file mode 100644 index 00000000..597d2f01 --- /dev/null +++ b/home/mail/default.nix @@ -0,0 +1,157 @@ +{ pkgs, hostName, ... }: + +{ + # accounts.emails.accounts = {}; # TODO + home.packages = with pkgs; [ protonmail-bridge davmail ]; + programs = { + mu.enable = true; + mbsync = { + enable = true; + extraConfig = '' + IMAPAccount protonmail + Host 127.0.0.1 + Port 1143 + User e.litherlandsmith@proton.me + PassCmd +"${pkgs.pass}/bin/pass show Mail/Proton/${hostName}" + SSLType NONE + AuthMechs LOGIN + + IMAPAccount icloud + Host imap.mail.me.com + Port 993 + User edwardjls@me.com + PassCmd +"${pkgs.pass}/bin/pass show Mail/iCloud/mbsync" + SSLType IMAPS + + IMAPAccount ukaea + Host 127.0.0.1 + Port 1144 + User evie.litherland-smith@ukaea.uk + PassCmd +"${pkgs.pass}/bin/pass show Mail/Outlook/ukaea" + SSLType None + AuthMechs LOGIN + + IMAPStore ProtonRemote + Account protonmail + + IMAPStore iCloudRemote + Account icloud + + IMAPStore UKAEARemote + Account ukaea + + MaildirStore ProtonLocal + Path ~/.mail/Proton/ + Inbox ~/.mail/Proton/Inbox/ + SubFolders Verbatim + + MaildirStore iCloudLocal + Path ~/.mail/iCloud/ + Inbox ~/.mail/iCloud/Inbox/ + SubFolders Verbatim + + MaildirStore UKAEALocal + Path ~/.mail/UKAEA/ + Inbox ~/.mail/UKAEA/Inbox/ + SubFolders Verbatim + + Channel ProtonInbox + Far :ProtonRemote:"INBOX" + Near :ProtonLocal:"Inbox" + Create Near + Expunge Both + SyncState * + + Channel ProtonFolders + Far :ProtonRemote: + Near :ProtonLocal: + Patterns * !"All Mail" !"INBOX" !"Inbox" + Create Both + Expunge Both + SyncState * + + Channel iCloudInbox + Far :iCloudRemote:"INBOX" + Near :iCloudLocal:"Inbox" + Create Near + Expunge Both + SyncState * + + Channel iCloudFolders + Far :iCloudRemote: + Near :iCloudLocal: + Patterns * !"All Mail" !"INBOX" !"Inbox" + Create Both + Expunge Both + SyncState * + + Channel UKAEAInbox + Far :UKAEARemote:"INBOX" + Near :UKAEALocal:"Inbox" + Create Near + Expunge Both + SyncState * + + Channel UKAEAFolders + Far :UKAEARemote: + Near :UKAEALocal: + Patterns * !"INBOX" !"Inbox" + Create Near + Expunge Both + SyncState * + + Group icloud + Channel iCloudInbox + Channel iCloudFolders + + Group protonmail + Channel ProtonInbox + Channel ProtonFolders + + Group ukaea + Channel UKAEAInbox + Channel UKAEAFolders + + Group inbox + Channel iCloudInbox + Channel ProtonInbox + Channel UKAEAInbox + ''; + }; + msmtp = { + enable = true; + extraConfig = '' + defaults + port 587 + + account protonmail + host 127.0.0.1 + from e.litherlandsmith@proton.me + auth login + user e.litherlandsmith@proton.me + passwordeval "${pkgs.pass}/bin/pass show Mail/Proton/${hostName}" + port 1025 + tls off + + account icloud + host smtp.mail.me.com + from e.litherlandsmith@icloud.com + auth on + user e.litherlandsmith@icloud.com + passwordeval "${pkgs.pass}/bin/pass show Mail/iCloud/mbsync" + port 587 + tls on + + account ukaea + host 127.0.0.1 + from evie.litherland-smith@ukaea.uk + auth login + user evie.litherland-smith@ukaea.uk + passwordeval "${pkgs.pass}/bin/pass show Mail/Outlook/ukaea" + port 1026 + tls off + ''; + }; + }; + services.mbsync.enable = true; +}