fork/home-manager

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

Genevieveaerc: add assertion to limit per-account extraConfig to UI config (#4196)bec87d53

master
1.9 KiB52 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5{
6  config = {
7    test.asserts.assertions.expected = [''
8      Only the ui section of $XDG_CONFIG_HOME/aerc.conf supports contextual (per-account) configuration.
9      Please configure it with accounts.email.accounts._.aerc.extraConfig.ui and move any other
10      configuration to programs.aerc.extraConfig.
11    ''];
12    test.asserts.warnings.expected = [''
13      aerc: `programs.aerc.enable` is set, but `...extraConfig.general.unsafe-accounts-conf` is set to false or unset.
14      This will prevent aerc from starting; see `unsafe-accounts-conf` in the man page aerc-config(5):
15      > By default, the file permissions of accounts.conf must be restrictive and only allow reading by the file owner (0600).
16      > Set this option to true to ignore this permission check. Use this with care as it may expose your credentials.
17      These permissions are not possible with home-manager, since the generated file is in the nix-store (permissions 0444).
18      Therefore, please set `programs.aerc.extraConfig.general.unsafe-accounts-conf = true`.
19      This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store.
20    ''];
21
22    test.stubs.aerc = { };
23
24    programs.aerc = {
25      enable = true;
26      extraAccounts = {
27        Test1 = {
28          source = "maildir:///dev/null";
29          enable-folders-sort = true;
30          folders = [ "INBOX" "SENT" "JUNK" ];
31        };
32      };
33      extraConfig.general = {
34        # unsafe-accounts-conf = true;
35        pgp-provider = "gpg";
36      };
37    };
38
39    accounts.email.accounts.Test2 = {
40      address = "addr@mail.invalid";
41      userName = "addr@mail.invalid";
42      realName = "Foo Bar";
43      primary = true;
44      imap.host = "imap.host.invalid";
45      passwordCommand = "echo PaSsWorD!";
46      aerc = {
47        enable = true;
48        extraConfig.general.pgp-provider = "internal";
49      };
50    };
51  };
52}