Initial setup of mbsync and msmtp in home-manager

This commit is contained in:
Evie Litherland-Smith 2023-09-01 15:18:29 +01:00
parent 2f69cb4c57
commit 09de275af1
3 changed files with 161 additions and 10 deletions

View file

@ -62,7 +62,8 @@
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = false; useUserPackages = false;
extraSpecialArgs = { extraSpecialArgs = {
inherit user hyprland anyrun wallpapers tokyonight; inherit hostName user shell hyprland anyrun wallpapers
tokyonight;
shellConfig = ./home/shell/${shell}.nix; shellConfig = ./home/shell/${shell}.nix;
}; };
users.${user} = import ./hosts/${hostName}/home.nix; users.${user} = import ./hosts/${hostName}/home.nix;
@ -74,7 +75,7 @@
home-manager.lib.homeManagerConfiguration { home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = { extraSpecialArgs = {
inherit user shell hyprland anyrun wallpapers tokyonight; inherit hostName user shell hyprland anyrun wallpapers tokyonight;
shellConfig = ./home/shell/${shell}.nix; shellConfig = ./home/shell/${shell}.nix;
}; };
modules = [ ./hosts/${hostName}/home.nix ]; modules = [ ./hosts/${hostName}/home.nix ];

View file

@ -1,7 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ ../git/default.nix ]; imports = [ ../git/default.nix ../mail/default.nix ];
programs.emacs.enable = true; programs.emacs.enable = true;
home.packages = with pkgs; [ home.packages = with pkgs; [
# Emacs dependencies # Emacs dependencies
@ -11,13 +11,6 @@
fd fd
graphviz graphviz
# Mail server setup
isync
mu
msmtp
protonmail-bridge
davmail
# Language-specific requirements # Language-specific requirements
ispell ispell
findutils findutils

157
home/mail/default.nix Normal file
View file

@ -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;
}