dotfiles/nixos/email-accounts.nix

80 lines
2.2 KiB
Nix

{ config, pkgs, inputs, ... }:
let unstable = inputs.nixpkgs-nixos-unstable.legacyPackages.${pkgs.system};
in {
home-manager.users.cyryl = {
accounts.email.accounts.cyplo = {
primary = true;
address = "cyplo@cyplo.dev";
aliases = [ "cyplo@cyplo.net" ];
realName = "Cyryl Płotnicki";
userName = "cyplo@cyplo.dev";
imap = {
host = "127.0.0.1";
port = 1143;
tls = {
enable = true;
useStartTls = true;
certificatesFile = "/home/cyryl/.config/protonmail/bridge/cert.pem";
};
};
smtp = {
host = "127.0.0.1";
port = 1025;
tls = {
enable = true;
useStartTls = true;
certificatesFile = "/home/cyryl/.config/protonmail/bridge/cert.pem";
};
};
mbsync = {
enable = true;
create = "maildir";
expunge = "maildir";
remove = "maildir";
};
msmtp = {
enable = true;
extraConfig = {
from = "cyplo@cyplo.dev";
auth = "plain";
};
};
notmuch.enable = true;
neomutt.enable = true;
passwordCommand = "${pkgs.pass}/bin/pass proton-bridge";
folders = {
drafts = "Drafts";
inbox = "INBOX";
sent = "Sent";
trash = "Trash";
};
};
programs.mbsync.enable = true;
programs.msmtp.enable = true;
programs.neomutt = { enable = true; };
programs.notmuch = {
enable = true;
hooks.preNew = "${pkgs.isync}/bin/mbsync -a";
};
programs.alot = { enable = true; };
home.packages = with pkgs; [ unstable.protonmail-bridge ];
services.mbsync.enable = true;
home.file.".mailcap".text = ''
text/html; ${pkgs.w3m}/bin/w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput
'';
systemd.user.services."proton-bridge" = {
Unit.Description = "Bridge to ProtonMail";
Install.WantedBy = [ "default.target" "mbsync.service" ];
Service.ExecStart =
"${unstable.protonmail-bridge}/bin/protonmail-bridge --noninteractive";
Service.Environment = "PATH=${pkgs.pass}/bin:${pkgs.gnupg}/bin";
};
};
}