This repository has been archived on 2024-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
nixos/modules/mail/gmail.nix
Payas Relekar 0522b8b006 phoebe: setup gmail
Uses a new app-password, but same name so I don't have to modify the
gmail module.

Oh, also moved hermes/mail.nix to modueles/mail/gmail.nix because now it
is shared.
2023-11-14 14:06:30 +05:30

73 lines
1.9 KiB
Nix

{ pkgs, ... }:
let
name = "Payas Relekar";
maildir = "/home/payas/.mail";
email = "relekarpayas@gmail.com";
in
{
accounts.email = {
maildirBasePath = maildir;
accounts = {
Gmail = {
address = email;
userName = email;
flavor = "gmail.com";
# passwordCommand = "cat ${config.age.secrets.mu4e_gmail.path}";
passwordCommand = "${pkgs.coreutils}/bin/cat /run/agenix/mu4e_gmail"; # TODO: Make this use agenix path variable instead of hardcoded path
primary = true;
# gpg.encryptByDefault = true;
mbsync = {
enable = true;
create = "both";
expunge = "both";
patterns = [ "*" "[Gmail]*" ]; # "[Gmail]/Sent Mail" ];
extraConfig.channel = {
CopyArrivalDate = "yes";
};
};
imap = {
host = "imap.gmail.com";
port = 993;
tls.enable = true;
};
imapnotify = {
enable = true;
boxes = [ "INBOX" ];
onNotify = "${pkgs.mu}/bin/mu index && ${pkgs.isync}/bin/mbsync --push --pull --all";
onNotifyPost = "${pkgs.mu}/bin/mu index && ${pkgs.libnotify}/bin/notify-send -h 'string:desktop-entry:emacs' 'New mail'";
};
realName = name;
msmtp.enable = true;
mu.enable = true;
smtp = {
host = "smtp.gmail.com";
port = 587;
tls.useStartTls = true;
};
};
};
};
services = {
imapnotify.enable = true;
mbsync = {
enable = true;
frequency = "*:0/15";
postExec = "${pkgs.mu}/bin/mu index";
};
};
systemd.user.services.mbsync.Service = {
ExecStartPre = [
"${pkgs.mu}/bin/mu index"
"${pkgs.isync}/bin/mbsync --push --all"
];
};
programs = {
msmtp.enable = true;
mbsync.enable = true;
mu.enable = true;
};
}