Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions modules/programs/aerc-accounts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ in {
example =
literalExpression ''{ source = "maildir://~/Maildir/example"; }'';
description = ''
Extra config added to the configuration of this account in
Extra config added to the configuration section for this account in
<filename>$HOME/.config/aerc/accounts.conf</filename>.
See aerc-config(5).
See <citerefentry><refentrytitle>aerc-accounts</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
'';
};

Expand All @@ -66,18 +66,20 @@ in {
''{ messages = { d = ":move ''${folder.trash}<Enter>"; }; }'';
description = ''
Extra bindings specific to this account, added to
<filename>$HOME/.config/aerc/accounts.conf</filename>.
See <citerefentry><refentrytitle>aerc-config</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
<filename>$HOME/.config/aerc/binds.conf</filename>.
See <citerefentry><refentrytitle>aerc-binds</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
'';
};

extraConfig = mkOption {
type = confSections;
default = { };
example = literalExpression "{ ui = { sidebar-width = 42; }; }";
example = literalExpression "{ ui = { sidebar-width = 25; }; }";
description = ''
Extra config specific to this account, added to
<filename>$HOME/.config/aerc/aerc.conf</filename>.
Config specific to this account, added to <filename>$HOME/.config/aerc/aerc.conf</filename>.
Aerc only supports per-account UI configuration.
For other sections of <filename>$HOME/.config/aerc/aerc.conf</filename>,
use <literal>.programs.aerc.extraConfig</literal>.
Comment thread
dryya marked this conversation as resolved.
Outdated
See <citerefentry><refentrytitle>aerc-config</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
'';
};
Expand Down
24 changes: 18 additions & 6 deletions modules/programs/aerc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
((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";
"values (null, bool, int, string, or float) or a list of values, that will be joined with a comma";
};

confSection = types.attrsOf primitive;
Expand Down Expand Up @@ -162,16 +162,28 @@ in {
in mkIf cfg.enable {
warnings = if genAccountsConf
&& (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 the man page aerc-config(5), which states:
aerc: `programs.aerc.enable` is set, but `...extraConfig.general.unsafe-accounts-conf` is set to false or unset.
This will prevent aerc from starting; see `unsafe-accounts-conf` in the man page aerc-config(5):
> By default, the file permissions of accounts.conf must be restrictive and only allow reading by the file owner (0600).
> Set this option to true to ignore this permission check. Use this with care as it may expose your credentials.
These file permissions are not possible with home-manger, since the generated file is stored in the nix-store with read-only access for all users (0444).
If `passwordCommand` is properly set, no credentials will be stored in the nix store.
Therefore, consider setting the option `extraConfig.general.unsafe-accounts-conf` to true.
These permissions are not possible with home-manger, since the generated file is in the nix-store (permissions 0444).
Therefore, please set `programs.aerc.extraConfig.general.unsafe-accounts-conf = true`.
This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store.
''] else
[ ];

assertions = [{
assertion = let
extraConfigSections = (unique (flatten
(mapAttrsToList (_: v: attrNames v.aerc.extraConfig) aerc-accounts)));
in extraConfigSections == [ ] || extraConfigSections == [ "ui" ];
message = ''
Only the UI section of <filename>$XDG_CONFIG_HOME/aerc/aerc.conf</filename>
supports contextual (per-account configuration. Please move any other
configuration to <literal>programs.aerc.extraConfig</literal>.
Comment thread
dryya marked this conversation as resolved.
Outdated
'';
}];

home.packages = [ cfg.package ];

xdg.configFile = {
Expand Down