From 324fedcf9f1c475e2f522d03af029528e65969bc Mon Sep 17 00:00:00 2001
From: Lukas Nagel <69244516+lukasngl@users.noreply.github.com>
Date: Thu, 11 Aug 2022 23:08:28 +0200
Subject: [PATCH] Add module for aerc (#3070)
This adds support for configuring email accounts, with automatic smtp, imap,
sendmail (msmpt) and maildir (mbsync, offlineimap) setup in aerc,
via `accounts.email`.
---
.github/CODEOWNERS | 4 +
modules/lib/maintainers.nix | 6 +
modules/modules.nix | 1 +
modules/programs/aerc-accounts.nix | 131 ++++++++++
modules/programs/aerc.nix | 165 +++++++++++++
tests/default.nix | 1 +
tests/modules/programs/aerc/default.nix | 4 +
.../programs/aerc/extraAccounts.expected | 76 ++++++
.../modules/programs/aerc/extraBinds.expected | 17 ++
.../programs/aerc/extraConfig.expected | 18 ++
tests/modules/programs/aerc/noSettings.nix | 18 ++
tests/modules/programs/aerc/settings.nix | 229 ++++++++++++++++++
.../modules/programs/aerc/stylesets.expected | 8 +
.../modules/programs/aerc/templates.expected | 3 +
14 files changed, 681 insertions(+)
create mode 100644 modules/programs/aerc-accounts.nix
create mode 100644 modules/programs/aerc.nix
create mode 100644 tests/modules/programs/aerc/default.nix
create mode 100644 tests/modules/programs/aerc/extraAccounts.expected
create mode 100644 tests/modules/programs/aerc/extraBinds.expected
create mode 100644 tests/modules/programs/aerc/extraConfig.expected
create mode 100644 tests/modules/programs/aerc/noSettings.nix
create mode 100644 tests/modules/programs/aerc/settings.nix
create mode 100644 tests/modules/programs/aerc/stylesets.expected
create mode 100644 tests/modules/programs/aerc/templates.expected
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index ad278c19..e5c32c98 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -56,6 +56,10 @@ Makefile @thiagokokada
/tests/modules/misc/xdg/desktop-full-expected.desktop @cwyc
/tests/modules/misc/xdg/desktop-min-expected.desktop @cwyc
+/modules/programs/aerc.nix @lukasngl
+/modules/programs/aerc-accounts.nix @lukasngl
+/tests/modules/programs/aerc @lukasngl
+
/modules/programs/aria2.nix @JustinLovinger
/modules/programs/autojump.nix @evanjs
diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix
index c3e7152b..81f6e417 100644
--- a/modules/lib/maintainers.nix
+++ b/modules/lib/maintainers.nix
@@ -299,4 +299,10 @@
github = "mtoohey31";
githubId = 36740602;
};
+ lukasngl = {
+ name = "Lukas Nagel";
+ email = "69244516+lukasngl@users.noreply.github.com";
+ github = "lukasngl";
+ githubId = 69244516;
+ };
}
diff --git a/modules/modules.nix b/modules/modules.nix
index fa8c9ebe..8a4ac0ab 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -43,6 +43,7 @@ let
./misc/xdg-user-dirs.nix
./misc/xdg.nix
./programs/abook.nix
+ ./programs/aerc.nix
./programs/afew.nix
./programs/alacritty.nix
./programs/alot.nix
diff --git a/modules/programs/aerc-accounts.nix b/modules/programs/aerc-accounts.nix
new file mode 100644
index 00000000..ebe1d541
--- /dev/null
+++ b/modules/programs/aerc-accounts.nix
@@ -0,0 +1,131 @@
+{ config, lib, pkgs, confSections, confSection, ... }:
+
+with lib;
+
+let
+ mapAttrNames = f: attr:
+ with builtins;
+ listToAttrs (attrValues (mapAttrs (k: v: {
+ name = f k;
+ value = v;
+ }) attr));
+ addAccountName = name: k: "${k}:account=${name}";
+in {
+ type = mkOption {
+ type = types.attrsOf (types.submodule {
+ options.aerc = {
+ enable = mkEnableOption "aerc";
+ extraAccounts = mkOption {
+ type = confSection;
+ default = { };
+ example =
+ literalExpression ''{ source = "maildir://~/Maildir/example"; }'';
+ description = ''
+ Extra config added to the configuration of this account in
+ $HOME/.config/aerc/accounts.conf.
+ See aerc-config(5).
+ '';
+ };
+ extraBinds = mkOption {
+ type = confSections;
+ default = { };
+ example = literalExpression
+ ''{ messages = { d = ":move ''${folder.trash}"; }; }'';
+ description = ''
+ Extra bindings specific to this account, added to
+ $HOME/.config/aerc/accounts.conf.
+ See aerc-config(5).
+ '';
+ };
+ extraConfig = mkOption {
+ type = confSections;
+ default = { };
+ example = literalExpression "{ ui = { sidebar-width = 42; }; }";
+ description = ''
+ Extra config specific to this account, added to
+ $HOME/.config/aerc/aerc.conf.
+ See aerc-config(5).
+ '';
+ };
+ smtpAuth = mkOption {
+ type = with types; nullOr (enum [ "none" "plain" "login" ]);
+ default = "plain";
+ example = "auth";
+ description = ''
+ Sets the authentication mechanism if smtp is used as the outgoing
+ method.
+ See aerc-smtp(5).
+ '';
+ };
+ };
+ });
+ };
+ mkAccount = name: account:
+ let
+ nullOrMap = f: v: if v == null then v else f v;
+ optPort = port: if port != null then ":${toString port}" else "";
+ optAttr = k: v:
+ if v != null && v != [ ] && v != "" then { ${k} = v; } else { };
+ optPwCmd = k: p:
+ optAttr "${k}-cred-cmd" (nullOrMap (builtins.concatStringsSep " ") p);
+ mkConfig = {
+ maildir = cfg: {
+ source =
+ "maildir://${config.accounts.email.maildirBasePath}/${cfg.maildir.path}";
+ };
+ imap = { userName, imap, passwordCommand, aerc, ... }@cfg:
+ let
+ protocol = if imap.tls.enable then
+ if imap.tls.useStartTls then "imap" else "imaps"
+ else
+ "imap+insecure";
+ port' = optPort imap.port;
+ in {
+ source = "${protocol}://${userName}@${imap.host}${port'}";
+ } // optPwCmd "source" passwordCommand;
+ smtp = { userName, smtp, passwordCommand, ... }@cfg:
+ let
+ loginMethod' =
+ if cfg.aerc.smtpAuth != null then "+${cfg.aerc.smtpAuth}" else "";
+ protocol = if smtp.tls.enable && !smtp.tls.useStartTls then
+ "smtps${loginMethod'}"
+ else
+ "smtp${loginMethod'}";
+ port' = optPort smtp.port;
+ smtp-starttls =
+ if smtp.tls.enable && smtp.tls.useStartTls then "yes" else null;
+ in {
+ outgoing = "${protocol}://${userName}@${smtp.host}${port'}";
+ } // optPwCmd "outgoing" passwordCommand
+ // optAttr "smtp-starttls" smtp-starttls;
+ msmtp = cfg: {
+ outgoing = "msmtpq --read-envelope-from --read-recipients";
+ };
+ };
+ basicCfg = account:
+ {
+ from = "${account.realName} <${account.address}>";
+ } // (optAttr "copy-to" account.folders.sent)
+ // (optAttr "default" account.folders.inbox)
+ // (optAttr "postpone" account.folders.drafts)
+ // (optAttr "aliases" account.aliases) // account.aerc.extraAccounts;
+ sourceCfg = account:
+ if account.mbsync.enable || account.offlineimap.enable then
+ mkConfig.maildir account
+ else if account.imap != null then
+ mkConfig.imap account
+ else
+ { };
+ outgoingCfg = account:
+ if account.msmtp.enable then
+ mkConfig.msmtp account
+ else if account.smtp != null then
+ mkConfig.smtp account
+ else
+ { };
+ in (basicCfg account) // (sourceCfg account) // (outgoingCfg account);
+ mkAccountConfig = name: account:
+ mapAttrNames (addAccountName name) account.aerc.extraConfig;
+ mkAccountBinds = name: account:
+ mapAttrNames (addAccountName name) account.aerc.extraBinds;
+}
diff --git a/modules/programs/aerc.nix b/modules/programs/aerc.nix
new file mode 100644
index 00000000..ad44bf90
--- /dev/null
+++ b/modules/programs/aerc.nix
@@ -0,0 +1,165 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.programs.aerc;
+ primitive = with types;
+ ((type: either type (listOf type)) (nullOr (oneOf [ str int bool float ])))
+ // {
+ description =
+ "values (null, bool, int, string of float) or a list of values, that will be joined with a comma";
+ };
+ confSection = types.attrsOf primitive;
+ confSections = types.attrsOf confSection;
+ sectionsOrLines = types.either types.lines confSections;
+ accounts = import ./aerc-accounts.nix {
+ inherit config pkgs lib confSection confSections;
+ };
+ aerc-accounts =
+ attrsets.filterAttrs (_: v: v.aerc.enable) config.accounts.email.accounts;
+in {
+ meta.maintainers = with lib.hm.maintainers; [ lukasngl ];
+
+ options.accounts.email.accounts = accounts.type;
+ options.programs.aerc = {
+
+ enable = mkEnableOption "aerc";
+
+ extraAccounts = mkOption {
+ type = sectionsOrLines;
+ default = { };
+ example = literalExpression
+ ''{ Work = { source = "maildir://~/Maildir/work"; }; }'';
+ description = ''
+ Extra lines added to $HOME/.config/aerc/accounts.conf.
+ See aerc-config(5).
+ '';
+ };
+
+ extraBinds = mkOption {
+ type = sectionsOrLines;
+ default = { };
+ example = literalExpression ''{ messages = { q = ":quit"; }; }'';
+ description = ''
+ Extra lines added to $HOME/.config/aerc/binds.conf.
+ Global keybindings can be set in the `global` section.
+ See aerc-config(5).
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = sectionsOrLines;
+ default = { };
+ example = literalExpression ''{ ui = { sort = "-r date"; }; }'';
+ description = ''
+ Extra lines added to $HOME/.config/aerc/aerc.conf.
+ See aerc-config(5).
+ '';
+ };
+
+ stylesets = mkOption {
+ type = with types; attrsOf (either confSection lines);
+ default = { };
+ example = literalExpression ''
+ { default = { ui = { "tab.selected.reverse" = toggle; }; }; };
+ '';
+ description = ''
+ Stylesets added to $HOME/.config/aerc/stylesets/.
+ See aerc-stylesets(7).
+ '';
+ };
+ templates = mkOption {
+ type = with types; attrsOf lines;
+ default = { };
+ example = literalExpression ''
+ { new_message = "Hello!"; };
+ '';
+ description = ''
+ Templates added to $HOME/.config/aerc/templates/.
+ See aerc-templates(7).
+ '';
+ };
+ };
+
+ config = let
+ joinCfg = cfgs:
+ with builtins;
+ concatStringsSep "\n" (filter (v: v != "") cfgs);
+ toINI = conf: # quirk: global section is prepended w/o section heading
+ let
+ global = conf.global or { };
+ local = removeAttrs conf [ "global" ];
+ optNewLine = if global != { } && local != { } then "\n" else "";
+ mkValueString = v:
+ with builtins;
+ if isList v then # join with comma
+ concatStringsSep "," (map (generators.mkValueStringDefault { }) v)
+ else
+ generators.mkValueStringDefault { } v;
+ mkKeyValue =
+ generators.mkKeyValueDefault { inherit mkValueString; } " = ";
+ in joinCfg [
+ (generators.toKeyValue { inherit mkKeyValue; } global)
+ (generators.toINI { inherit mkKeyValue; } local)
+ ];
+ mkINI = conf: if builtins.isString conf then conf else toINI conf;
+ mkStyleset = attrsets.mapAttrs' (k: v:
+ let value = if builtins.isString v then v else toINI { global = v; };
+ in {
+ name = "aerc/stylesets/${k}";
+ value.text = joinCfg [ header value ];
+ });
+ mkTemplates = attrsets.mapAttrs' (k: v: {
+ name = "aerc/templates/${k}";
+ value.text = v;
+ });
+ accountsExtraAccounts = builtins.mapAttrs accounts.mkAccount aerc-accounts;
+ accountsExtraConfig =
+ builtins.mapAttrs accounts.mkAccountConfig aerc-accounts;
+ accountsExtraBinds =
+ builtins.mapAttrs accounts.mkAccountBinds aerc-accounts;
+ joinContextual = contextual:
+ with builtins;
+ joinCfg (map mkINI (attrValues contextual));
+ header = ''
+ # Generated by Home Manager.
+ '';
+ in mkIf cfg.enable {
+ warnings = if ((cfg.extraAccounts != "" && cfg.extraAccounts != { })
+ || accountsExtraAccounts != { })
+ && (cfg.extraConfig.general.unsafe-accounts-conf or false) == false then [''
+ aerc: An email account was configured, but `extraConfig.general.unsafe-accounts-conf` is set to false or unset.
+ This will prevent aerc from starting, see `unsafe-accounts-conf` in aerc-config(5) for details.
+ Consider setting the option `extraConfig.general.unsafe-accounts-conf` to true.
+ ''] else
+ [ ];
+ home.packages = [ pkgs.aerc ];
+ xdg.configFile = {
+ "aerc/accounts.conf" = mkIf
+ ((cfg.extraAccounts != "" && cfg.extraAccounts != { })
+ || accountsExtraAccounts != { }) {
+ text = joinCfg [
+ header
+ (mkINI cfg.extraAccounts)
+ (mkINI accountsExtraAccounts)
+ ];
+ };
+ "aerc/aerc.conf" =
+ mkIf (cfg.extraConfig != "" && cfg.extraConfig != { }) {
+ text = joinCfg [
+ header
+ (mkINI cfg.extraConfig)
+ (joinContextual accountsExtraConfig)
+ ];
+ };
+ "aerc/binds.conf" = mkIf ((cfg.extraBinds != "" && cfg.extraBinds != { })
+ || accountsExtraBinds != { }) {
+ text = joinCfg [
+ header
+ (mkINI cfg.extraBinds)
+ (joinContextual accountsExtraBinds)
+ ];
+ };
+ } // (mkStyleset cfg.stylesets) // (mkTemplates cfg.templates);
+ };
+}
diff --git a/tests/default.nix b/tests/default.nix
index 0ee98c30..6adee16a 100644
--- a/tests/default.nix
+++ b/tests/default.nix
@@ -53,6 +53,7 @@ import nmt {
./modules/misc/fontconfig
./modules/misc/nix
./modules/misc/specialization
+ ./modules/programs/aerc
./modules/programs/alacritty
./modules/programs/alot
./modules/programs/aria2
diff --git a/tests/modules/programs/aerc/default.nix b/tests/modules/programs/aerc/default.nix
new file mode 100644
index 00000000..f5d81092
--- /dev/null
+++ b/tests/modules/programs/aerc/default.nix
@@ -0,0 +1,4 @@
+{
+ aerc-noSettings = ./noSettings.nix;
+ aerc-settings = ./settings.nix;
+}
diff --git a/tests/modules/programs/aerc/extraAccounts.expected b/tests/modules/programs/aerc/extraAccounts.expected
new file mode 100644
index 00000000..15749c03
--- /dev/null
+++ b/tests/modules/programs/aerc/extraAccounts.expected
@@ -0,0 +1,76 @@
+# Generated by Home Manager.
+
+[Test1]
+enable-folders-sort = true
+folders = INBOX,SENT,JUNK
+source = maildir:///dev/null
+
+[Test2]
+pgp-key-id = 42
+
+[a_imap-nopasscmd-tls-starttls-folders]
+copy-to = aercSent
+default = aercInbox
+from = Foo Bar
+postpone = aercDrafts
+source = imap://foobar@imap.host.invalid:1337
+
+[b_imap-passcmd-tls-nostarttls-extraAccounts]
+connection-timeout = 42s
+from = Foo Bar
+source = imaps://foobar@imap.host.invalid:1337
+source-cred-cmd = echo PaSsWorD!
+
+[c_imap-passcmd-notls-nostarttls-extraConfig]
+from = Foo Bar
+source = imap+insecure://foobar@imap.host.invalid:1337
+source-cred-cmd = echo PaSsWorD!
+
+[d_imap-passcmd-notls-starttls-extraBinds]
+from = Foo Bar
+source = imap+insecure://foobar@imap.host.invalid:1337
+source-cred-cmd = echo PaSsWorD!
+
+[e_smtp-nopasscmd-tls-starttls]
+from = Foo Bar
+outgoing = smtp+plain://foobar@smtp.host.invalid:42
+smtp-starttls = yes
+
+[f_smtp-passcmd-tls-nostarttls]
+from = Foo Bar
+outgoing = smtps+plain://foobar@smtp.host.invalid:42
+outgoing-cred-cmd = echo PaSsWorD!
+
+[g_smtp-passcmd-notls-nostarttls]
+from = Foo Bar
+outgoing = smtp+plain://foobar@smtp.host.invalid:42
+outgoing-cred-cmd = echo PaSsWorD!
+
+[h_smtp-passcmd-notls-starttls]
+from = Foo Bar
+outgoing = smtp+plain://foobar@smtp.host.invalid:42
+outgoing-cred-cmd = echo PaSsWorD!
+
+[i_maildir-mbsync]
+from = Foo Bar
+source = maildir:///home/hm-user/Maildir/i_maildir-mbsync
+
+[j_maildir-offlineimap]
+from = Foo Bar
+source = maildir:///home/hm-user/Maildir/j_maildir-offlineimap
+
+[l_smpt-auth-none]
+from = Foo Bar
+outgoing = smtps+none://foobar@smtp.host.invalid:42
+
+[m_smpt-auth-plain]
+from = Foo Bar
+outgoing = smtps+plain://foobar@smtp.host.invalid:42
+
+[n_smpt-auth-login]
+from = Foo Bar
+outgoing = smtps+login://foobar@smtp.host.invalid:42
+
+[o_msmtp]
+from = Foo Bar
+outgoing = msmtpq --read-envelope-from --read-recipients
diff --git a/tests/modules/programs/aerc/extraBinds.expected b/tests/modules/programs/aerc/extraBinds.expected
new file mode 100644
index 00000000..36ce9d93
--- /dev/null
+++ b/tests/modules/programs/aerc/extraBinds.expected
@@ -0,0 +1,17 @@
+# Generated by Home Manager.
+
+ = :next-tab
+ = :prev-tab
+ = :term
+
+[compose::editor]
+$ex =
+$noinherit = true
+ = :prev-field
+
+[messages]
+j = :next
+q = :quit
+
+[messages:account=d_imap-passcmd-notls-starttls-extraBinds]
+d = :move Trash
diff --git a/tests/modules/programs/aerc/extraConfig.expected b/tests/modules/programs/aerc/extraConfig.expected
new file mode 100644
index 00000000..416db406
--- /dev/null
+++ b/tests/modules/programs/aerc/extraConfig.expected
@@ -0,0 +1,18 @@
+# Generated by Home Manager.
+
+[general]
+unsafe-accounts-conf = true
+
+[ui]
+index-format = null
+mouse-enabled = false
+sidebar-width = 42
+sort = -r date
+spinner = true,2,3.400000,5
+test-float = 1337.420000
+
+[ui:account=Test]
+sidebar-width = 1337
+
+[ui:account=c_imap-passcmd-notls-nostarttls-extraConfig]
+index-format = %42.1337n
diff --git a/tests/modules/programs/aerc/noSettings.nix b/tests/modules/programs/aerc/noSettings.nix
new file mode 100644
index 00000000..c941c19b
--- /dev/null
+++ b/tests/modules/programs/aerc/noSettings.nix
@@ -0,0 +1,18 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ config = {
+ nmt.script = let dir = "home-files/.config/aerc";
+ in ''
+ assertPathNotExists ${dir}/accounts.conf
+ assertPathNotExists ${dir}/aerc.conf
+ assertPathNotExists ${dir}/binds.conf
+ assertPathNotExists ${dir}/stylesets
+ '';
+ programs.aerc.enable = true;
+
+ test.stubs.aerc = { };
+ };
+}
diff --git a/tests/modules/programs/aerc/settings.nix b/tests/modules/programs/aerc/settings.nix
new file mode 100644
index 00000000..2fded9cc
--- /dev/null
+++ b/tests/modules/programs/aerc/settings.nix
@@ -0,0 +1,229 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ config = {
+ nmt.script = let dir = "home-files/.config/aerc";
+ in ''
+ assertFileContent ${dir}/accounts.conf ${./extraAccounts.expected}
+ assertFileContent ${dir}/binds.conf ${./extraBinds.expected}
+ assertFileContent ${dir}/aerc.conf ${./extraConfig.expected}
+ assertFileContent ${dir}/templates/bar ${./templates.expected}
+ assertFileContent ${dir}/templates/foo ${./templates.expected}
+ assertFileContent ${dir}/stylesets/default ${./stylesets.expected}
+ assertFileContent ${dir}/stylesets/asLines ${./stylesets.expected}
+ '';
+
+ test.stubs.aerc = { };
+
+ programs.aerc = {
+ enable = true;
+
+ extraAccounts = {
+ Test1 = {
+ source = "maildir:///dev/null";
+ enable-folders-sort = true;
+ folders = [ "INBOX" "SENT" "JUNK" ];
+ };
+ Test2 = { pgp-key-id = 42; };
+ };
+
+ extraBinds = {
+ global = {
+ "" = ":prev-tab";
+ "" = ":next-tab";
+ "" = ":term";
+ };
+ messages = {
+ q = ":quit";
+ j = ":next";
+ };
+ "compose::editor" = {
+ "$noinherit" = "true";
+ "$ex" = "";
+ "" = ":prev-field";
+ };
+ };
+
+ extraConfig = {
+ general.unsafe-accounts-conf = true;
+ ui = {
+ index-format = null;
+ sort = "-r date";
+ spinner = [ true 2 3.4 "5" ];
+ sidebar-width = 42;
+ mouse-enabled = false;
+ test-float = 1337.42;
+ };
+ "ui:account=Test" = { sidebar-width = 1337; };
+ };
+
+ stylesets = {
+ asLines = ''
+ *.default = true
+ *.selected.reverse = toggle
+ *error.bold = true
+ error.fg = red
+ header.bold = true
+ title.reverse = true
+ '';
+ default = {
+ "*.default" = "true";
+ "*error.bold" = "true";
+ "error.fg" = "red";
+ "header.bold" = "true";
+ "*.selected.reverse" = "toggle";
+ "title.reverse" = "true";
+ };
+ };
+
+ templates = rec {
+ foo = ''
+ X-Mailer: aerc {{version}}
+
+ Just a test.
+ '';
+ bar = foo;
+ };
+ };
+
+ accounts.email.accounts = let
+ basics = {
+ aerc = { enable = true; };
+ realName = "Foo Bar";
+ userName = "foobar";
+ address = "addr@mail.invalid";
+ folders = {
+ drafts = "";
+ inbox = "";
+ sent = "";
+ trash = "";
+ };
+ };
+ in {
+ a_imap-nopasscmd-tls-starttls-folders = basics // {
+ primary = true;
+ imap = {
+ host = "imap.host.invalid";
+ port = 1337;
+ tls.enable = true;
+ tls.useStartTls = true;
+ };
+ folders = {
+ drafts = "aercDrafts";
+ inbox = "aercInbox";
+ sent = "aercSent";
+ };
+ };
+ b_imap-passcmd-tls-nostarttls-extraAccounts = basics // {
+ passwordCommand = "echo PaSsWorD!";
+ imap = {
+ host = "imap.host.invalid";
+ port = 1337;
+ tls.enable = true;
+ tls.useStartTls = false;
+ };
+ aerc = {
+ enable = true;
+ extraAccounts = { connection-timeout = "42s"; };
+ };
+ };
+ c_imap-passcmd-notls-nostarttls-extraConfig = basics // {
+ passwordCommand = "echo PaSsWorD!";
+ aerc = {
+ enable = true;
+ extraConfig = { ui.index-format = "%42.1337n"; };
+ };
+ imap = {
+ host = "imap.host.invalid";
+ port = 1337;
+ tls.enable = false;
+ tls.useStartTls = false;
+ };
+ };
+ d_imap-passcmd-notls-starttls-extraBinds = basics // {
+ passwordCommand = "echo PaSsWorD!";
+ imap = {
+ host = "imap.host.invalid";
+ port = 1337;
+ tls.enable = false;
+ tls.useStartTls = true;
+ };
+ aerc = {
+ enable = true;
+ extraBinds = { messages = { d = ":move Trash"; }; };
+ };
+ };
+ e_smtp-nopasscmd-tls-starttls = basics // {
+ smtp = {
+ host = "smtp.host.invalid";
+ port = 42;
+ tls.enable = true;
+ tls.useStartTls = true;
+ };
+ };
+ f_smtp-passcmd-tls-nostarttls = basics // {
+ passwordCommand = "echo PaSsWorD!";
+ smtp = {
+ host = "smtp.host.invalid";
+ port = 42;
+ tls.enable = true;
+ tls.useStartTls = false;
+ };
+ };
+ g_smtp-passcmd-notls-nostarttls = basics // {
+ passwordCommand = "echo PaSsWorD!";
+ smtp = {
+ host = "smtp.host.invalid";
+ port = 42;
+ tls.enable = false;
+ tls.useStartTls = false;
+ };
+ };
+ h_smtp-passcmd-notls-starttls = basics // {
+ passwordCommand = "echo PaSsWorD!";
+ smtp = {
+ host = "smtp.host.invalid";
+ port = 42;
+ tls.enable = false;
+ tls.useStartTls = true;
+ };
+ };
+ i_maildir-mbsync = basics // { mbsync.enable = true; };
+ j_maildir-offlineimap = basics // { offlineimap.enable = true; };
+ k_notEnabled = basics // { aerc.enable = false; };
+ l_smpt-auth-none = basics // {
+ smtp = {
+ host = "smtp.host.invalid";
+ port = 42;
+ };
+ aerc = {
+ enable = true;
+ smtpAuth = "none";
+ };
+ };
+ m_smpt-auth-plain = basics // {
+ smtp = {
+ host = "smtp.host.invalid";
+ port = 42;
+ };
+ aerc = {
+ enable = true;
+ smtpAuth = "plain";
+ };
+ };
+ n_smpt-auth-login = basics // {
+ smtp = {
+ host = "smtp.host.invalid";
+ port = 42;
+ };
+ aerc = {
+ enable = true;
+ smtpAuth = "login";
+ };
+ };
+ o_msmtp = basics // { msmtp = { enable = true; }; };
+ };
+ };
+}
diff --git a/tests/modules/programs/aerc/stylesets.expected b/tests/modules/programs/aerc/stylesets.expected
new file mode 100644
index 00000000..f6ab9d43
--- /dev/null
+++ b/tests/modules/programs/aerc/stylesets.expected
@@ -0,0 +1,8 @@
+# Generated by Home Manager.
+
+*.default = true
+*.selected.reverse = toggle
+*error.bold = true
+error.fg = red
+header.bold = true
+title.reverse = true
diff --git a/tests/modules/programs/aerc/templates.expected b/tests/modules/programs/aerc/templates.expected
new file mode 100644
index 00000000..5e6b7289
--- /dev/null
+++ b/tests/modules/programs/aerc/templates.expected
@@ -0,0 +1,3 @@
+X-Mailer: aerc {{version}}
+
+Just a test.