1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-19 08:19:48 +01:00
home-manager/modules/programs/neomutt-accounts.nix
Jan van Brügge bf6b85136b
neomutt: Allow named mailboxes (#2212)
At the moment, only the inbox of each mail account is added to neomutt.
This inbox is always called "Inbox", so if you configure multiple
accounts, it is hard to know which one is which.

This change allows the user to specify a display name per account that
uses `named-mailboxes` under the hood.

Additionally this change now allows to add other folders than the inbox,
for example the Trash, Spam or Drafts folders to be added on a per-account
basis. Using extraOptions is not possible here, as those are lazily
loaded on mailbox open and thus would appear at the bottom and not sorted
by account.

This commit also changes the default sidebar format string to use %D
instead of %B because %B will ignore named mailboxes and show the folder
name instead.
2021-08-19 00:33:53 -04:00

67 lines
1.6 KiB
Nix

{ config, lib, ... }:
with lib;
let
extraMailboxOptions = {
options = {
mailbox = mkOption {
type = types.str;
example = "Sent";
description = "Name of mailbox folder to be included";
};
name = mkOption {
type = types.nullOr types.str;
example = "Junk";
default = null;
description = "Name to display";
};
};
};
in {
options.neomutt = {
enable = mkEnableOption "NeoMutt";
sendMailCommand = mkOption {
type = types.nullOr types.str;
default = if config.msmtp.enable then
"msmtpq --read-envelope-from --read-recipients"
else
null;
defaultText = literalExample ''
if config.msmtp.enable then
"msmtpq --read-envelope-from --read-recipients"
else
null
'';
example = "msmtpq --read-envelope-from --read-recipients";
description = ''
Command to send a mail. If not set, neomutt will be in charge of sending mails.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
example = "color status cyan default";
description = ''
Extra lines to add to the folder hook for this account.
'';
};
mailboxName = mkOption {
type = types.nullOr types.str;
default = null;
example = "==== <mailbox-name> ===";
description = "Use a different name as mailbox name";
};
extraMailboxes = mkOption {
type = with types; listOf (either str (submodule extraMailboxOptions));
default = [ ];
description = "List of extra mailboxes";
};
};
}