dotfiles/modules/common/mail/default.nix

85 lines
2.3 KiB
Nix
Raw Normal View History

2022-10-30 17:57:14 +00:00
{ config, pkgs, lib, ... }: {
imports = [ ./himalaya.nix ./aerc.nix ];
options = {
2022-12-22 00:31:25 +00:00
mail.enable = lib.mkEnableOption "Mail service.";
2022-12-21 21:18:03 +00:00
mail.user = lib.mkOption {
2022-10-30 17:57:14 +00:00
type = lib.types.str;
description = "User name for the email address.";
default = config.user;
};
2022-12-21 21:18:03 +00:00
mail.server = lib.mkOption {
2022-10-30 17:57:14 +00:00
type = lib.types.str;
description = "Server name for the email address.";
};
};
2022-12-22 00:31:25 +00:00
config = lib.mkIf config.mail.enable {
2022-10-30 17:57:14 +00:00
home-manager.users.${config.user} = {
programs.mbsync = { enable = true; };
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
frequency = "*:0/5";
};
accounts.email = {
maildirBasePath = "${config.homePath}/mail";
accounts = {
2022-12-21 21:18:03 +00:00
home = let address = "${config.mail.user}@${config.mail.server}";
2022-10-30 17:57:14 +00:00
in {
userName = address;
realName = config.fullName;
primary = true;
inherit address;
2022-12-21 21:18:03 +00:00
aliases = map (user: "${user}@${config.mail.server}") [
2022-10-30 17:57:14 +00:00
"me"
"hey"
"admin"
];
alot = { };
flavor = "plain";
folders = { };
getmail = { };
imap = {
host = "imap.purelymail.com";
port = 993;
tls.enable = true;
};
imapnotify = {
enable = false;
boxes = [ ];
onNotify = "";
onNotifyPost = "";
};
maildir = { path = "main"; };
mbsync = {
enable = true;
create = "maildir";
expunge = "none";
remove = "none";
patterns = [ "*" ];
extraConfig.channel = {
CopyArrivalDate = "yes"; # Sync time of original message
};
};
mu.enable = false;
notmuch.enable = false;
passwordCommand =
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
builtins.toString ../../private/mailpass.age
}";
smtp = {
host = "smtp.purelymail.com";
port = 465;
tls.enable = true;
};
};
};
};
};
};
}