blob: 6ce45745ffbc3e1bccc45468b809d4fa9e0b1c8d [file] [log] [blame]
Skyler Grey252927a2022-10-18 22:18:15 +01001{ pkgs
2, config
3, username
Skyler Grey252927a2022-10-18 22:18:15 +01004, home
5, lib
6, ...
Skyler Grey8753c522022-09-02 00:04:02 +01007}: {
8 home = {
Skyler Grey8753c522022-09-02 00:04:02 +01009 accounts.email = {
10 maildirBasePath = "Mail";
11 accounts = {
12 collabora = {
13 astroid = {
14 enable = true;
15 sendMailCommand = "${pkgs.msmtp}/bin/msmtpq --read-envelope-from --read-recipients";
16 };
17 msmtp.enable = true;
18 aerc = {
19 enable = true;
20 extraAccounts = {
21 source = "notmuch://~/${home.accounts.email.maildirBasePath}/collabora";
22 };
23 };
Skyler Grey7fdf72e2023-02-26 13:03:33 +000024 himalaya = {
25 enable = true;
26 backend = "imap";
27 sender = "smtp";
28 };
Skyler Grey8753c522022-09-02 00:04:02 +010029 neomutt.enable = true;
30 mbsync = {
31 enable = true;
32 create = "maildir";
33 };
34 notmuch.enable = true;
35 address = "skyler.grey@collabora.com";
36 imap = {
37 host = "mail.collabora.com";
38 port = 143;
39 tls.useStartTls = true;
40 };
41 smtp = {
42 host = "mail.collabora.com";
43 port = 587;
44 tls.useStartTls = true;
45 };
46 userName = "skyler";
47 realName = "Skyler Grey";
48 primary = true;
49 signature = {
50 showSignature = "append";
51 text = ''
52 Miss Skyler Grey
53 Intern
54
55 Collabora Ltd.
56 Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
57 Registered in England & Wales, no. 5513718'';
58 };
59 passwordCommand = "${pkgs.coreutils}/bin/cat ${config.sops.secrets.collaboraPassword.path}";
60 };
61 };
62 };
63 programs.astroid.enable = true;
64 programs.msmtp.enable = true;
65 services.mbsync = {
66 enable = true;
67 postExec = "${pkgs.notmuch}/bin/notmuch new";
68 };
69 programs.mbsync.enable = true;
70 programs.himalaya.enable = true;
71 programs.neomutt = {
72 enable = true;
73 sidebar.enable = true;
74 settings = {
75 preferred_languages = "en";
76 };
77 extraConfig = ''
78 auto_view text/html
79 '';
80 };
81 programs.notmuch.enable = true;
82 programs.aerc = {
83 enable = true;
84 extraConfig.general.unsafe-accounts-conf = true;
Skyler Grey252927a2022-10-18 22:18:15 +010085 extraBinds = lib.pipe ./email/aerc-default-binds.toml [ builtins.readFile builtins.fromTOML ];
86 extraConfig.filters =
87 let
88 defaultFilters = lib.pipe "${pkgs.aerc}/share/aerc/filters" [
89 builtins.readDir
90 builtins.attrNames
91 (builtins.map (f: {
92 name = f;
93 value = "${pkgs.aerc}/share/aerc/filters/${f}";
94 }))
95 builtins.listToAttrs
96 ];
97 in
Skyler Greya9addb32022-10-31 00:22:55 +000098 with defaultFilters; {
99 "text/plain" = colorize;
100 "text/calendar" = defaultFilters."show-ics-details.py";
101 "text/html" = html;
102 };
Skyler Grey8753c522022-09-02 00:04:02 +0100103 };
Skyler Grey252927a2022-10-18 22:18:15 +0100104 home.packages = with pkgs; [ lynx ];
Skyler Grey8753c522022-09-02 00:04:02 +0100105 home.file.".mailcap".text = ''
106 text/html; ${pkgs.lynx}/bin/lynx -force_html -dump %s; copiousoutput
107 image/*; ${pkgs.kitty}/bin/kitty +kitten icat && read -r -n1 key
108 '';
109 home.shellAliases = {
110 mutt = "${pkgs.neomutt}/bin/neomutt";
111 };
112 };
113 config = {
114 sops.secrets.collaboraPassword = {
115 mode = "0400";
116 owner = config.users.users.${username}.name;
117 group = config.users.users.nobody.group;
118 };
Skyler Grey252927a2022-10-18 22:18:15 +0100119 environment.persistence."/nix/persist".users.${username}.directories = [ "Mail" ];
Skyler Grey8753c522022-09-02 00:04:02 +0100120 };
121}