83 lines
2.2 KiB
Nix
83 lines
2.2 KiB
Nix
{...}: {
|
|
config.flake.modules.homeManager.mail = {
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
default_account_params = {
|
|
realName = "Aner Zakobar";
|
|
mbsync = {
|
|
enable = true;
|
|
create = "maildir";
|
|
};
|
|
};
|
|
default_gmail_params =
|
|
default_account_params
|
|
// {
|
|
flavor = "gmail.com";
|
|
};
|
|
default_smtp = {
|
|
tls = {
|
|
enable = true;
|
|
certificatesFile = "/etc/ssl/certs/ca-certificates.crt";
|
|
};
|
|
};
|
|
in {
|
|
options.azos.mail.enable = lib.mkOption {
|
|
default = true;
|
|
type = lib.types.bool;
|
|
};
|
|
config = lib.mkIf config.azos.mail.enable {
|
|
programs = {
|
|
mu.enable = true;
|
|
mbsync.enable = true;
|
|
msmtp.enable = true;
|
|
lieer.enable = true;
|
|
};
|
|
home.activation.muInit = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
|
if [ ! -d "$HOME/.cache/mu" ]; then
|
|
$DRY_RUN_CMD ${pkgs.mu}/bin/mu init \
|
|
--maildir="$HOME/Maildir" \
|
|
--my-address=aner@zakobar.com \
|
|
--my-address=anerisgreat@gmail.com \
|
|
--my-address=anerz@post.bgu.ac.il
|
|
fi
|
|
'';
|
|
services.lieer.enable = true;
|
|
accounts.email.accounts = {
|
|
gmail =
|
|
default_gmail_params
|
|
// {
|
|
address = "anerisgreat@gmail.com";
|
|
userName = "anerisgreat";
|
|
passwordCommand = "pass mbsync/anerisgreat@gmail.com | head -1";
|
|
};
|
|
bgu =
|
|
default_gmail_params
|
|
// {
|
|
address = "anerz@post.bgu.ac.il";
|
|
userName = "anerz@post.bgu.ac.il";
|
|
passwordCommand = "pass mbsync/anerz@post.bgu.ac.il | head -1";
|
|
};
|
|
zakobar =
|
|
default_account_params
|
|
// {
|
|
address = "aner@zakobar.com";
|
|
msmtp.enable = true;
|
|
primary = true;
|
|
userName = "aner@zakobar.com";
|
|
imap = {host = "mail.privateemail.com";};
|
|
smtp =
|
|
default_smtp
|
|
// {
|
|
port = 587;
|
|
host = "mail.privateemail.com";
|
|
};
|
|
passwordCommand = "pass privateemail.com | head -1";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|