nixos-config/home-manager/email.nix

40 lines
856 B
Nix
Raw Normal View History

2024-02-13 15:30:26 -05:00
{ config, pkgs, fullname, email, ... }:
2024-02-13 15:13:46 -05:00
let
2024-02-13 15:30:26 -05:00
maildir = "${config.xdg.dataHome}/mail";
pass = config.programs.password-store.package;
2024-02-13 15:13:46 -05:00
in {
accounts.email = {
maildirBasePath = maildir;
accounts = {
2024-02-13 15:30:26 -05:00
gmail = {
2024-02-13 15:13:46 -05:00
address = email;
userName = email;
flavor = "gmail.com";
2024-02-13 15:30:26 -05:00
passwordCommand = "${pass}/bin/pass Email/gmail.com";
2024-02-13 15:13:46 -05:00
primary = true;
mbsync = {
enable = true;
create = "both";
expunge = "both";
patterns = [ "*" ];
};
realName = fullname;
msmtp.enable = true;
};
};
};
programs = {
msmtp.enable = true;
mbsync.enable = true;
};
services = {
mbsync = {
enable = true;
preExec = "${pkgs.isync}/bin/mbsync -Ha";
postExec = "${pkgs.mu}/bin/mu index -m ${maildir}";
};
};
}