Skip to content

Commit

Permalink
email: switch to archival setup only
Browse files Browse the repository at this point in the history
Using the Fastmail web UI for actually reading and composing email now,
but will keep mbsync and neofetch for archiving and viewing archived
emails.
  • Loading branch information
DanNixon committed Mar 19, 2024
1 parent 20b05d2 commit 6ad031e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 215 deletions.
109 changes: 13 additions & 96 deletions modules/home-manager/email/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,113 +3,30 @@
config,
pkgs,
...
}: let
secrets = import ./secrets.nix;
in {
}: {
imports = [
./mailcap.nix
./neomutt.nix
];

programs.mbsync.enable = true;
programs.msmtp.enable = true;

accounts.email.maildirBasePath = ".mail";

accounts.email.accounts = {
fastmail = let
a = secrets.accounts.fastmail;
in {
primary = true;
accounts.email.accounts.fastmail = {
primary = true;

address = a.address;
realName = a.realName;
userName = a.address;
passwordCommand = "pass Passwords/Personal/fastmail/api_password";
address = "[email protected]";
realName = "Dan Nixon";
userName = "[email protected]";
passwordCommand = "pass Passwords/Personal/fastmail/api_password";

imap.host = "imap.fastmail.com";
mbsync = {
enable = true;
create = "both";
imap.host = "imap.fastmail.com";
mbsync = {
enable = true;
create = "both";
extraConfig.channel = {
CopyArrivalDate = "yes";
};

smtp = {
host = "smtp.fastmail.com";
port = 587;
tls.useStartTls = true;
};
msmtp.enable = true;
};

gmail = let
a = secrets.accounts.gmail;
in {
address = a.address;
realName = a.realName;
userName = a.address;
passwordCommand = "pass Passwords/Personal/google/email_password";

imap.host = "imap.gmail.com";
mbsync = {
enable = true;
create = "both";
patterns = [
"*"
"![Google Mail]/All Mail"
"![Google Mail]/All mail"
];
};

smtp = {
host = "smtp.gmail.com";
port = 587;
tls.useStartTls = true;
};
msmtp.enable = true;
};

outlook-1 = let
a = secrets.accounts.outlook-1;
in {
address = a.address;
realName = a.realName;
userName = a.address;
passwordCommand = "pass Passwords/Personal/microsoft_1/Password";

imap.host = "outlook.office365.com";
mbsync = {
enable = true;
create = "both";
};

smtp = {
host = "smtp.office365.com";
port = 587;
tls.useStartTls = true;
};
msmtp.enable = true;
};

outlook-2 = let
a = secrets.accounts.outlook-2;
in {
address = a.address;
realName = a.realName;
userName = a.address;
passwordCommand = "pass Passwords/Personal/microsoft_2/Password";

imap.host = "outlook.office365.com";
mbsync = {
enable = true;
create = "both";
};

smtp = {
host = "smtp.office365.com";
port = 587;
tls.useStartTls = true;
};
msmtp.enable = true;
};
};
}
11 changes: 0 additions & 11 deletions modules/home-manager/email/mailcap.nix

This file was deleted.

94 changes: 7 additions & 87 deletions modules/home-manager/email/neomutt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
pkgs,
lib,
...
}: let
secrets = import ./secrets.nix;
in {
}: {
home.packages = with pkgs; [
neomutt
];
Expand Down Expand Up @@ -91,94 +89,16 @@ in {
color normal default default
# Mailboxes
set folder = ~/.mail/
set spoolfile = "+local/Inbox"
set record = "+local/Sent"
set trash = "+local/Trash"
set postponed = "+local/Drafts"
mailboxes \
+local \
+local/Inbox \
+local/Sent \
+local/Archive \
+local/Drafts \
+local/Trash
mailboxes ${lib.strings.concatMapStringsSep " " (x: "+local/" + x) secrets.extra-local-mailboxes}
set folder = ~/.mail/
# Account: fastmail
mailboxes \
+fastmail \
+fastmail/Inbox \
+fastmail/Spam
folder-hook \
"+fastmail.*" \
'source ~/${config.xdg.configFile."neomutt/accounts/fastmail".target}'
# Account: gmail
mailboxes \
+gmail \
+gmail/Inbox \
"+gmail/[Google Mail]" \
"+gmail/[Google Mail]/Spam"
folder-hook \
"+gmail.*" \
'source ~/${config.xdg.configFile."neomutt/accounts/gmail".target}'
# Account: outlook-1
mailboxes \
+outlook-1 \
+outlook-1/Inbox \
+outlook-1/Junk
folder-hook \
"+outlook-1.*" \
'source ~/${config.xdg.configFile."neomutt/accounts/outlook-1".target}'
# Account: outlook-2
mailboxes \
+outlook-2 \
+outlook-2/Inbox \
+outlook-2/Junk
folder-hook \
"+outlook-2.*" \
'source ~/${config.xdg.configFile."neomutt/accounts/outlook-2".target}'
'';

xdg.configFile."neomutt/accounts/fastmail".text = let
a = secrets.accounts.fastmail;
in ''
set from = "${a.address}"
set realname = "${a.realName}"
set sendmail = "msmtp -a fastmail"
'';

xdg.configFile."neomutt/accounts/gmail".text = let
a = secrets.accounts.gmail;
in ''
set from = "${a.address}"
set realname = "${a.realName}"
set sendmail = "msmtp -a gmail"
'';

xdg.configFile."neomutt/accounts/outlook-1".text = let
a = secrets.accounts.outlook-1;
in ''
set from = "${a.address}"
set realname = "${a.realName}"
set sendmail = "msmtp -a outlook-1"
'';

xdg.configFile."neomutt/accounts/outlook-2".text = let
a = secrets.accounts.outlook-2;
in ''
set from = "${a.address}"
set realname = "${a.realName}"
set sendmail = "msmtp -a outlook-2"
+fastmail/Archive \
+fastmail/Drafts \
+fastmail/Sent \
+fastmail/Spam \
+fastmail/Trash
'';
}
21 changes: 0 additions & 21 deletions modules/home-manager/email/secrets.nix

This file was deleted.

0 comments on commit 6ad031e

Please sign in to comment.