fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Knut Magnus Aasrudaerc: fix config paths on darwin1369d2ce

master
6.8 KiB256 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5{
6  config = {
7    nmt.script = let
8      dir = if (pkgs.stdenv.isDarwin && !config.xdg.enable) then
9        "home-files/Library/Preferences/aerc"
10      else
11        "home-files/.config/aerc";
12    in ''
13      assertFileContent   ${dir}/accounts.conf     ${./extraAccounts.expected}
14      assertFileContent   ${dir}/binds.conf        ${./extraBinds.expected}
15      assertFileContent   ${dir}/aerc.conf         ${./extraConfig.expected}
16      assertFileContent   ${dir}/templates/bar     ${./templates.expected}
17      assertFileContent   ${dir}/templates/foo     ${./templates.expected}
18      assertFileContent   ${dir}/stylesets/default ${./stylesets.expected}
19      assertFileContent   ${dir}/stylesets/asLines ${./stylesets.expected}
20    '';
21
22    test.stubs.aerc = { };
23
24    programs.aerc = {
25      enable = true;
26
27      extraAccounts = {
28        Test1 = {
29          source = "maildir:///dev/null";
30          enable-folders-sort = true;
31          folders = [ "INBOX" "SENT" "JUNK" ];
32        };
33        Test2 = { pgp-key-id = 42; };
34      };
35
36      extraBinds = {
37        global = {
38          "<C-p>" = ":prev-tab<Enter>";
39          "<C-n>" = ":next-tab<Enter>";
40          "<C-t>" = ":term<Enter>";
41        };
42        messages = {
43          q = ":quit<Enter>";
44          j = ":next<Enter>";
45        };
46        "compose::editor" = {
47          "$noinherit" = "true";
48          "$ex" = "<C-x>";
49          "<C-k>" = ":prev-field<Enter>";
50        };
51      };
52
53      extraConfig = {
54        general.unsafe-accounts-conf = true;
55        ui = {
56          index-format = null;
57          sort = "-r date";
58          spinner = [ true 2 3.4 "5" ];
59          sidebar-width = 42;
60          mouse-enabled = false;
61          test-float = 1337.42;
62        };
63        "ui:account=Test" = { sidebar-width = 1337; };
64      };
65
66      stylesets = {
67        asLines = ''
68          *.default = true
69          *.selected.reverse = toggle
70          *error.bold = true
71          error.fg = red
72          header.bold = true
73          title.reverse = true
74        '';
75        default = {
76          "*.default" = "true";
77          "*error.bold" = "true";
78          "error.fg" = "red";
79          "header.bold" = "true";
80          "*.selected.reverse" = "toggle";
81          "title.reverse" = "true";
82        };
83      };
84
85      templates = rec {
86        foo = ''
87          X-Mailer: aerc {{version}}
88
89          Just a test.
90        '';
91        bar = foo;
92      };
93    };
94
95    accounts.email.accounts = let
96      basics = {
97        aerc = { enable = true; };
98        realName = "Foo Bar";
99        userName = "foobar";
100        address = "addr@mail.invalid";
101        folders = {
102          drafts = "";
103          inbox = "";
104          sent = "";
105          trash = "";
106        };
107      };
108    in {
109      primary = basics // {
110        primary = true;
111        imap = {
112          host = "imap.host.invalid";
113          port = 1337;
114          tls.enable = true;
115          tls.useStartTls = true;
116        };
117      };
118      a_imap-nopasscmd-tls-starttls-folders = basics // {
119        imap = {
120          host = "imap.host.invalid";
121          port = 1337;
122          tls.enable = true;
123          tls.useStartTls = true;
124        };
125        folders = {
126          drafts = "aercDrafts";
127          inbox = "aercInbox";
128          sent = "aercSent";
129        };
130      };
131      b_imap-passcmd-tls-nostarttls-extraAccounts = basics // {
132        passwordCommand = "echo PaSsWorD!";
133        imap = {
134          host = "imap.host.invalid";
135          port = 1337;
136          tls.enable = true;
137          tls.useStartTls = false;
138        };
139        aerc = {
140          enable = true;
141          extraAccounts = { connection-timeout = "42s"; };
142        };
143      };
144      c_imap-passcmd-notls-nostarttls-extraConfig = basics // {
145        passwordCommand = "echo PaSsWorD!";
146        aerc = {
147          enable = true;
148          extraConfig = { ui.index-format = "%42.1337n"; };
149        };
150        imap = {
151          host = "imap.host.invalid";
152          port = 1337;
153          tls.enable = false;
154          tls.useStartTls = false;
155        };
156      };
157      d_imap-passcmd-notls-starttls-extraBinds = basics // {
158        passwordCommand = "echo PaSsWorD!";
159        imap = {
160          host = "imap.host.invalid";
161          port = 1337;
162          tls.enable = false;
163          tls.useStartTls = true;
164        };
165        aerc = {
166          enable = true;
167          extraBinds = { messages = { d = ":move Trash<Enter>"; }; };
168        };
169      };
170      e_smtp-nopasscmd-tls-starttls = basics // {
171        smtp = {
172          host = "smtp.host.invalid";
173          port = 42;
174          tls.enable = true;
175          tls.useStartTls = true;
176        };
177      };
178      f_smtp-passcmd-tls-nostarttls = basics // {
179        passwordCommand = "echo PaSsWorD!";
180        smtp = {
181          host = "smtp.host.invalid";
182          port = 42;
183          tls.enable = true;
184          tls.useStartTls = false;
185        };
186      };
187      g_smtp-passcmd-notls-nostarttls = basics // {
188        passwordCommand = "echo PaSsWorD!";
189        smtp = {
190          host = "smtp.host.invalid";
191          port = 42;
192          tls.enable = false;
193          tls.useStartTls = false;
194        };
195      };
196      h_smtp-passcmd-notls-starttls = basics // {
197        passwordCommand = "echo PaSsWorD!";
198        smtp = {
199          host = "smtp.host.invalid";
200          port = 42;
201          tls.enable = false;
202          tls.useStartTls = true;
203        };
204      };
205      i_maildir-mbsync = basics // { mbsync.enable = true; };
206      j_maildir-offlineimap = basics // { offlineimap.enable = true; };
207      k_notEnabled = basics // { aerc.enable = false; };
208      l_smtp-auth-none = basics // {
209        smtp = {
210          host = "smtp.host.invalid";
211          port = 42;
212        };
213        aerc = {
214          enable = true;
215          smtpAuth = "none";
216        };
217      };
218      m_smtp-auth-plain = basics // {
219        smtp = {
220          host = "smtp.host.invalid";
221          port = 42;
222        };
223        aerc = {
224          enable = true;
225          smtpAuth = "plain";
226        };
227      };
228      n_smtp-auth-login = basics // {
229        smtp = {
230          host = "smtp.host.invalid";
231          port = 42;
232        };
233        aerc = {
234          enable = true;
235          smtpAuth = "login";
236        };
237      };
238      o_msmtp = basics // { msmtp = { enable = true; }; };
239      p_overwrite_defaults = basics // {
240        smtp.host = "should.be.overwritten.invalid";
241        imap.host = "should.be.overwritten.invalid";
242        aerc = {
243          enable = true;
244          extraAccounts = {
245            from = "test <test@email.invalid>";
246            outgoing =
247              "imap+plain://intentionallyWrong:PaSsWorD@smtp.host.invalid:1337";
248            source =
249              "smtp+plain://intentionallyWrong:PaSsWorD@smtp.host.invalid:1337";
250            postpone = "dRaFts";
251          };
252        };
253      };
254    };
255  };
256}