71 lines
1.7 KiB
Nix
71 lines
1.7 KiB
Nix
{ config, pkgs, lib, fullname, email, ... }:
|
|
let
|
|
ksumail = "bsheiban@students.kennesaw.edu";
|
|
maildir = "${config.xdg.dataHome}/mail";
|
|
pass = config.programs.password-store.package;
|
|
|
|
oauth-mail = pkgs.stdenv.mkDerivation {
|
|
pname = "oauth-mail";
|
|
version = "1.0.0";
|
|
|
|
buildInputs = [ pkgs.python3 ];
|
|
|
|
dontUnpack = true;
|
|
installPhase = ''
|
|
install -Dm755 ${./email/oauth-mail.py} \
|
|
$out/bin/oauth-mail
|
|
'';
|
|
meta.mainProgram = "oauth-mail";
|
|
};
|
|
in {
|
|
programs = {
|
|
msmtp.enable = true;
|
|
mbsync.enable = true;
|
|
mu.enable = true;
|
|
};
|
|
home.packages = [ pkgs.emacsPackages.mu4e oauth-mail ];
|
|
|
|
accounts.email = {
|
|
maildirBasePath = maildir;
|
|
accounts = {
|
|
gmail = {
|
|
address = email;
|
|
userName = email;
|
|
flavor = "gmail.com";
|
|
passwordCommand = "${lib.getExe pass} email/Auth/${email}";
|
|
primary = true;
|
|
mbsync = {
|
|
enable = true;
|
|
create = "both";
|
|
expunge = "both";
|
|
patterns = [ "*" ];
|
|
};
|
|
realName = fullname;
|
|
msmtp.enable = true;
|
|
mu.enable = true;
|
|
};
|
|
ksu = {
|
|
address = ksumail;
|
|
userName = ksumail;
|
|
flavor = "outlook.office365.com";
|
|
passwordCommand = "${lib.getExe oauth-mail} $PASSWORD_STORE_DIR/email/Auth/${ksumail}";
|
|
mbsync = {
|
|
enable = true;
|
|
create = "both";
|
|
expunge = "both";
|
|
patterns = [ "*" ];
|
|
};
|
|
realName = fullname;
|
|
msmtp.enable = true;
|
|
mu.enable = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
services = {
|
|
mbsync = {
|
|
enable = true;
|
|
postExec = "${lib.getExe pkgs.mu} index -m ${maildir}";
|
|
};
|
|
};
|
|
}
|