blob: 7f5cbc2f70f829935aa09bf97e53e3b69a5b390b [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 };
24 himalaya.enable = true;
25 neomutt.enable = true;
26 mbsync = {
27 enable = true;
28 create = "maildir";
29 };
30 notmuch.enable = true;
31 address = "skyler.grey@collabora.com";
32 imap = {
33 host = "mail.collabora.com";
34 port = 143;
35 tls.useStartTls = true;
36 };
37 smtp = {
38 host = "mail.collabora.com";
39 port = 587;
40 tls.useStartTls = true;
41 };
42 userName = "skyler";
43 realName = "Skyler Grey";
44 primary = true;
45 signature = {
46 showSignature = "append";
47 text = ''
48 Miss Skyler Grey
49 Intern
50
51 Collabora Ltd.
52 Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
53 Registered in England & Wales, no. 5513718'';
54 };
55 passwordCommand = "${pkgs.coreutils}/bin/cat ${config.sops.secrets.collaboraPassword.path}";
56 };
57 };
58 };
59 programs.astroid.enable = true;
60 programs.msmtp.enable = true;
61 services.mbsync = {
62 enable = true;
63 postExec = "${pkgs.notmuch}/bin/notmuch new";
64 };
65 programs.mbsync.enable = true;
66 programs.himalaya.enable = true;
67 programs.neomutt = {
68 enable = true;
69 sidebar.enable = true;
70 settings = {
71 preferred_languages = "en";
72 };
73 extraConfig = ''
74 auto_view text/html
75 '';
76 };
77 programs.notmuch.enable = true;
78 programs.aerc = {
79 enable = true;
80 extraConfig.general.unsafe-accounts-conf = true;
Skyler Grey252927a2022-10-18 22:18:15 +010081 extraBinds = lib.pipe ./email/aerc-default-binds.toml [ builtins.readFile builtins.fromTOML ];
82 extraConfig.filters =
83 let
84 defaultFilters = lib.pipe "${pkgs.aerc}/share/aerc/filters" [
85 builtins.readDir
86 builtins.attrNames
87 (builtins.map (f: {
88 name = f;
89 value = "${pkgs.aerc}/share/aerc/filters/${f}";
90 }))
91 builtins.listToAttrs
92 ];
93 in
Skyler Greya9addb32022-10-31 00:22:55 +000094 with defaultFilters; {
95 "text/plain" = colorize;
96 "text/calendar" = defaultFilters."show-ics-details.py";
97 "text/html" = html;
98 };
Skyler Grey8753c522022-09-02 00:04:02 +010099 };
Skyler Grey252927a2022-10-18 22:18:15 +0100100 home.packages = with pkgs; [ lynx ];
Skyler Grey8753c522022-09-02 00:04:02 +0100101 home.file.".mailcap".text = ''
102 text/html; ${pkgs.lynx}/bin/lynx -force_html -dump %s; copiousoutput
103 image/*; ${pkgs.kitty}/bin/kitty +kitten icat && read -r -n1 key
104 '';
105 home.shellAliases = {
106 mutt = "${pkgs.neomutt}/bin/neomutt";
107 };
108 };
109 config = {
110 sops.secrets.collaboraPassword = {
111 mode = "0400";
112 owner = config.users.users.${username}.name;
113 group = config.users.users.nobody.group;
114 };
Skyler Grey252927a2022-10-18 22:18:15 +0100115 environment.persistence."/nix/persist".users.${username}.directories = [ "Mail" ];
Skyler Grey8753c522022-09-02 00:04:02 +0100116 };
117}