dotfiles/nixos/email-accounts.nix

80 lines
2.2 KiB
Nix
Raw Normal View History

2021-12-26 15:32:54 +00:00
{ config, pkgs, inputs, ... }:
2022-03-10 12:25:23 +00:00
let unstable = inputs.nixpkgs-nixos-unstable.legacyPackages.${pkgs.system};
in {
2021-11-22 19:32:26 +00:00
home-manager.users.cyryl = { ... }: {
2021-06-13 12:05:16 +01:00
accounts.email.accounts.cyplo = {
primary = true;
address = "cyplo@cyplo.dev";
2021-06-13 12:05:16 +01:00
aliases = [ "cyplo@cyplo.net" ];
realName = "Cyryl Płotnicki";
2022-01-08 10:23:29 +00:00
userName = "cyplo@cyplo.dev";
imap = {
host = "127.0.0.1";
port = 1143;
2021-12-26 15:32:54 +00:00
tls = {
2022-02-20 14:40:37 +00:00
enable = true;
useStartTls = true;
certificatesFile = "/home/cyryl/.config/protonmail/bridge/cert.pem";
2021-12-26 15:32:54 +00:00
};
};
smtp = {
host = "127.0.0.1";
port = 1025;
2022-01-08 10:23:29 +00:00
tls = {
2022-02-20 14:40:37 +00:00
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";
2022-01-08 10:23:29 +00:00
};
};
notmuch.enable = true;
2022-02-20 14:40:37 +00:00
neomutt.enable = true;
passwordCommand = "${pkgs.pass}/bin/pass proton-bridge";
folders = {
2021-07-03 13:15:42 +01:00
drafts = "Drafts";
inbox = "INBOX";
sent = "Sent";
trash = "Trash";
};
};
2022-02-20 14:40:37 +00:00
programs.mbsync.enable = true;
programs.msmtp.enable = true;
2022-03-10 12:25:23 +00:00
programs.neomutt = { enable = true; };
2022-02-20 14:40:37 +00:00
programs.notmuch = {
2021-08-01 07:58:21 +01:00
enable = true;
2022-02-20 14:40:37 +00:00
hooks.preNew = "${pkgs.isync}/bin/mbsync -a";
};
2022-03-10 12:25:23 +00:00
programs.alot = { enable = true; };
2021-12-26 15:32:54 +00:00
2022-03-10 12:25:23 +00:00
home.packages = with pkgs; [ unstable.protonmail-bridge ];
2021-06-13 12:05:16 +01:00
2022-02-20 14:40:37 +00:00
services.mbsync.enable = true;
home.file.".mailcap".text = ''
text/html; ${pkgs.w3m}/bin/w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput
'';
2022-01-08 10:23:29 +00:00
systemd.user.services."proton-bridge" = {
2021-06-13 12:05:16 +01:00
Unit.Description = "Bridge to ProtonMail";
2022-02-20 14:40:37 +00:00
Install.WantedBy = [ "default.target" "mbsync.service" ];
2022-03-10 12:25:23 +00:00
Service.ExecStart =
"${unstable.protonmail-bridge}/bin/protonmail-bridge --noninteractive";
2022-02-20 14:40:37 +00:00
Service.Environment = "PATH=${pkgs.pass}/bin:${pkgs.gnupg}/bin";
2021-06-13 12:05:16 +01:00
};
};
}