2020-10-12 00:22:58 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.neomutt;
|
|
|
|
|
|
|
|
neomuttAccounts =
|
|
|
|
filter (a: a.neomutt.enable) (attrValues config.accounts.email.accounts);
|
|
|
|
|
2024-06-04 18:23:39 +00:00
|
|
|
accountCommandNeeded = any (a:
|
|
|
|
a.neomutt.enable && (a.neomutt.mailboxType == "imap"
|
|
|
|
|| (any (m: !isString m && m.type == "imap") a.neomutt.extraMailboxes)))
|
|
|
|
(attrValues config.accounts.email.accounts);
|
|
|
|
|
|
|
|
accountCommand = let
|
|
|
|
imapAccounts = filter (a:
|
|
|
|
a.neomutt.enable && a.imap.host != null && a.userName != null
|
|
|
|
&& a.passwordCommand != null) (attrValues config.accounts.email.accounts);
|
|
|
|
accountCase = account:
|
|
|
|
let passwordCmd = toString account.passwordCommand;
|
|
|
|
in ''
|
|
|
|
${account.userName}@${account.imap.host})
|
|
|
|
found=1
|
|
|
|
username="${account.userName}"
|
|
|
|
password="$(${passwordCmd})"
|
|
|
|
;;'';
|
|
|
|
in pkgs.writeShellScriptBin "account-command.sh" ''
|
|
|
|
# Automatically set login variables based on the current account.
|
|
|
|
# This requires NeoMutt >= 2022-05-16
|
|
|
|
|
|
|
|
while [ ! -z "$1" ]; do
|
|
|
|
case "$1" in
|
|
|
|
--hostname)
|
|
|
|
shift
|
|
|
|
hostname="$1"
|
|
|
|
;;
|
|
|
|
--username)
|
|
|
|
shift
|
|
|
|
username="$1@"
|
|
|
|
;;
|
|
|
|
--type)
|
|
|
|
shift
|
|
|
|
type="$1"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
found=
|
|
|
|
case "''${username}''${hostname}" in
|
|
|
|
${concatMapStringsSep "\n" accountCase imapAccounts}
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -n "$found" ]; then
|
|
|
|
echo "username: $username"
|
|
|
|
echo "password: $password"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
sidebarModule = types.submodule {
|
|
|
|
options = {
|
|
|
|
enable = mkEnableOption "sidebar support";
|
|
|
|
|
|
|
|
width = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 22;
|
|
|
|
description = "Width of the sidebar";
|
|
|
|
};
|
|
|
|
|
|
|
|
shortPath = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
By default sidebar shows the full path of the mailbox, but
|
|
|
|
with this enabled only the relative name is shown.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
format = mkOption {
|
|
|
|
type = types.str;
|
2021-11-04 16:42:44 +00:00
|
|
|
default = "%D%?F? [%F]?%* %?N?%N/?%S";
|
2020-10-12 00:22:58 +00:00
|
|
|
description = ''
|
|
|
|
Sidebar format. Check neomutt documentation for details.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
sortOptions = [
|
|
|
|
"date"
|
|
|
|
"date-received"
|
|
|
|
"from"
|
|
|
|
"mailbox-order"
|
|
|
|
"score"
|
|
|
|
"size"
|
|
|
|
"spam"
|
|
|
|
"subject"
|
|
|
|
"threads"
|
|
|
|
"to"
|
|
|
|
];
|
|
|
|
|
|
|
|
bindModule = types.submodule {
|
|
|
|
options = {
|
|
|
|
map = mkOption {
|
2021-07-02 22:36:30 +00:00
|
|
|
type = let
|
|
|
|
menus = [
|
|
|
|
"alias"
|
|
|
|
"attach"
|
|
|
|
"browser"
|
|
|
|
"compose"
|
|
|
|
"editor"
|
|
|
|
"generic"
|
|
|
|
"index"
|
|
|
|
"mix"
|
|
|
|
"pager"
|
|
|
|
"pgp"
|
|
|
|
"postpone"
|
|
|
|
"query"
|
|
|
|
"smime"
|
|
|
|
];
|
|
|
|
in with types; either (enum menus) (listOf (enum menus));
|
2020-10-12 00:22:58 +00:00
|
|
|
default = "index";
|
|
|
|
description = "Select the menu to bind the command to.";
|
|
|
|
};
|
|
|
|
|
|
|
|
key = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "<left>";
|
|
|
|
description = "The key to bind.";
|
|
|
|
};
|
|
|
|
|
|
|
|
action = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "<enter-command>toggle sidebar_visible<enter><refresh>";
|
|
|
|
description = "Specify the action to take.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-08-08 10:19:01 +00:00
|
|
|
mkNotmuchVirtualboxes = virtualMailboxes:
|
|
|
|
"${concatStringsSep "\n" (map ({ name, query, limit, type }:
|
|
|
|
''
|
|
|
|
virtual-mailboxes "${name}" "notmuch://?query=${lib.escapeURL query}${
|
|
|
|
optionalString (limit != null) "&limit=${toString limit}"
|
|
|
|
}${optionalString (type != null) "&type=${type}"}"'')
|
|
|
|
virtualMailboxes)}";
|
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
setOption = n: v: if v == null then "unset ${n}" else "set ${n}=${v}";
|
|
|
|
escape = replaceStrings [ "%" ] [ "%25" ];
|
|
|
|
|
|
|
|
accountFilename = account: config.xdg.configHome + "/neomutt/" + account.name;
|
|
|
|
|
2024-06-04 18:23:39 +00:00
|
|
|
accountRootIMAP = account:
|
|
|
|
let
|
|
|
|
userName =
|
|
|
|
lib.optionalString (account.userName != null) "${account.userName}@";
|
|
|
|
port = lib.optionalString (account.imap.port != null)
|
|
|
|
":${toString account.imap.port}";
|
|
|
|
protocol = if account.imap.tls.enable then "imaps" else "imap";
|
|
|
|
in "${protocol}://${userName}${account.imap.host}${port}";
|
|
|
|
|
|
|
|
accountRoot = account:
|
|
|
|
if account.neomutt.mailboxType == "imap" then
|
|
|
|
accountRootIMAP account
|
|
|
|
else
|
|
|
|
account.maildir.absPath;
|
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
genCommonFolderHooks = account:
|
|
|
|
with account; {
|
|
|
|
from = "'${address}'";
|
|
|
|
realname = "'${realName}'";
|
|
|
|
spoolfile = "'+${folders.inbox}'";
|
|
|
|
record = if folders.sent == null then null else "'+${folders.sent}'";
|
|
|
|
postponed = "'+${folders.drafts}'";
|
|
|
|
trash = "'+${folders.trash}'";
|
|
|
|
};
|
|
|
|
|
|
|
|
mtaSection = account:
|
|
|
|
with account;
|
|
|
|
let passCmd = concatStringsSep " " passwordCommand;
|
|
|
|
in if neomutt.sendMailCommand != null then {
|
|
|
|
sendmail = "'${neomutt.sendMailCommand}'";
|
|
|
|
} else
|
|
|
|
let
|
2024-01-05 11:06:15 +00:00
|
|
|
smtpProto =
|
|
|
|
if smtp.tls.enable && !smtp.tls.useStartTls then "smtps" else "smtp";
|
2020-10-12 00:22:58 +00:00
|
|
|
smtpPort = if smtp.port != null then ":${toString smtp.port}" else "";
|
|
|
|
smtpBaseUrl =
|
|
|
|
"${smtpProto}://${escape userName}@${smtp.host}${smtpPort}";
|
|
|
|
in {
|
|
|
|
smtp_url = "'${smtpBaseUrl}'";
|
2021-07-02 22:36:30 +00:00
|
|
|
smtp_pass = ''"`${passCmd}`"'';
|
2020-10-12 00:22:58 +00:00
|
|
|
};
|
|
|
|
|
2024-06-04 18:23:39 +00:00
|
|
|
genAccountConfig = account:
|
2020-10-12 00:22:58 +00:00
|
|
|
with account;
|
|
|
|
let
|
2021-07-02 22:36:30 +00:00
|
|
|
folderHook = mapAttrsToList setOption (genCommonFolderHooks account
|
|
|
|
// optionalAttrs cfg.changeFolderWhenSourcingAccount {
|
2024-06-04 18:23:39 +00:00
|
|
|
folder = "'${accountRoot account}'";
|
2021-07-02 22:36:30 +00:00
|
|
|
});
|
2020-10-12 00:22:58 +00:00
|
|
|
in ''
|
|
|
|
${concatStringsSep "\n" folderHook}
|
|
|
|
'';
|
|
|
|
|
|
|
|
registerAccount = account:
|
2021-11-04 16:42:44 +00:00
|
|
|
let
|
|
|
|
mailboxes = if account.neomutt.mailboxName == null then
|
|
|
|
"mailboxes"
|
|
|
|
else
|
|
|
|
''named-mailboxes "${account.neomutt.mailboxName}"'';
|
2024-06-04 18:23:39 +00:00
|
|
|
mailroot = accountRoot account;
|
|
|
|
hookName = if account.neomutt.mailboxType == "imap" then
|
|
|
|
"account-hook"
|
|
|
|
else
|
|
|
|
"folder-hook";
|
2021-11-04 16:42:44 +00:00
|
|
|
extraMailboxes = concatMapStringsSep "\n" (extra:
|
2024-06-04 18:23:39 +00:00
|
|
|
let
|
|
|
|
mailboxroot = if !isString extra && extra.type == "imap" then
|
|
|
|
accountRootIMAP account
|
|
|
|
else if !isString extra && extra.type == "maildir" then
|
|
|
|
account.maildir.absPath
|
|
|
|
else
|
|
|
|
mailroot;
|
|
|
|
in if isString extra then
|
|
|
|
''mailboxes "${mailboxroot}/${extra}"''
|
2021-11-04 16:42:44 +00:00
|
|
|
else if extra.name == null then
|
2024-06-04 18:23:39 +00:00
|
|
|
''mailboxes "${mailboxroot}/${extra.mailbox}"''
|
2021-11-04 16:42:44 +00:00
|
|
|
else
|
2024-06-04 18:23:39 +00:00
|
|
|
''named-mailboxes "${extra.name}" "${mailboxroot}/${extra.mailbox}"'')
|
2021-11-04 16:42:44 +00:00
|
|
|
account.neomutt.extraMailboxes;
|
|
|
|
in with account; ''
|
2020-10-12 00:22:58 +00:00
|
|
|
# register account ${name}
|
2024-06-04 18:23:39 +00:00
|
|
|
${optionalString account.neomutt.showDefaultMailbox
|
|
|
|
''${mailboxes} "${mailroot}/${folders.inbox}"''}
|
2021-11-04 16:42:44 +00:00
|
|
|
${extraMailboxes}
|
2024-06-04 18:23:39 +00:00
|
|
|
${hookName} ${mailroot}/ " \
|
2020-10-12 00:22:58 +00:00
|
|
|
source ${accountFilename account} "
|
|
|
|
'';
|
|
|
|
|
|
|
|
mraSection = account:
|
|
|
|
with account;
|
2024-06-04 18:23:39 +00:00
|
|
|
if account.imap.host != null || account.maildir != null then
|
|
|
|
genAccountConfig account
|
2020-10-12 00:22:58 +00:00
|
|
|
else
|
2024-06-04 18:23:39 +00:00
|
|
|
throw "Only maildir and IMAP is supported at the moment";
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
optionsStr = attrs: concatStringsSep "\n" (mapAttrsToList setOption attrs);
|
|
|
|
|
|
|
|
sidebarSection = ''
|
|
|
|
# Sidebar
|
|
|
|
set sidebar_visible = yes
|
2023-01-10 09:35:00 +00:00
|
|
|
set sidebar_short_path = ${lib.hm.booleans.yesNo cfg.sidebar.shortPath}
|
2020-10-12 00:22:58 +00:00
|
|
|
set sidebar_width = ${toString cfg.sidebar.width}
|
|
|
|
set sidebar_format = '${cfg.sidebar.format}'
|
|
|
|
'';
|
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
genBindMapper = bindType:
|
|
|
|
concatMapStringsSep "\n" (bind:
|
|
|
|
''
|
|
|
|
${bindType} ${
|
|
|
|
concatStringsSep "," (toList bind.map)
|
|
|
|
} ${bind.key} "${bind.action}"'');
|
2020-10-12 00:22:58 +00:00
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
bindSection = (genBindMapper "bind") cfg.binds;
|
|
|
|
|
|
|
|
macroSection = (genBindMapper "macro") cfg.macros;
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
mailCheckSection = ''
|
|
|
|
set mail_check_stats
|
|
|
|
set mail_check_stats_interval = ${toString cfg.checkStatsInterval}
|
|
|
|
'';
|
|
|
|
|
|
|
|
notmuchSection = account:
|
2023-08-08 10:19:01 +00:00
|
|
|
let virtualMailboxes = account.notmuch.neomutt.virtualMailboxes;
|
|
|
|
in with account; ''
|
2020-10-12 00:22:58 +00:00
|
|
|
# notmuch section
|
|
|
|
set nm_default_uri = "notmuch://${config.accounts.email.maildirBasePath}"
|
2023-08-08 10:19:01 +00:00
|
|
|
${optionalString
|
|
|
|
(notmuch.neomutt.enable && builtins.length virtualMailboxes > 0)
|
|
|
|
(mkNotmuchVirtualboxes virtualMailboxes)}
|
2020-10-12 00:22:58 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
accountStr = account:
|
|
|
|
with account;
|
2023-01-10 09:35:00 +00:00
|
|
|
let
|
|
|
|
signature = if account.signature.showSignature == "none" then
|
|
|
|
"unset signature"
|
|
|
|
else if account.signature.command != null then
|
|
|
|
''set signature = "${account.signature.command}|"''
|
|
|
|
else
|
|
|
|
"set signature = ${
|
|
|
|
pkgs.writeText "signature.txt" account.signature.text
|
|
|
|
}";
|
|
|
|
in ''
|
2024-06-04 18:23:39 +00:00
|
|
|
# Generated by Home Manager.${
|
|
|
|
optionalString cfg.unmailboxes ''
|
|
|
|
|
|
|
|
unmailboxes *
|
|
|
|
''
|
|
|
|
}
|
2024-01-05 11:06:15 +00:00
|
|
|
set ssl_force_tls = ${
|
2024-06-04 18:23:39 +00:00
|
|
|
lib.hm.booleans.yesNo (imap.tls.enable || imap.tls.useStartTls)
|
2024-01-05 11:06:15 +00:00
|
|
|
}
|
2021-11-04 16:42:44 +00:00
|
|
|
set certificate_file=${toString config.accounts.email.certificatesFile}
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
# GPG section
|
2023-01-10 09:35:00 +00:00
|
|
|
set crypt_autosign = ${lib.hm.booleans.yesNo (gpg.signByDefault or false)}
|
|
|
|
set crypt_opportunistic_encrypt = ${
|
|
|
|
lib.hm.booleans.yesNo (gpg.encryptByDefault or false)
|
|
|
|
}
|
2020-10-12 00:22:58 +00:00
|
|
|
set pgp_use_gpg_agent = yes
|
|
|
|
set mbox_type = ${if maildir != null then "Maildir" else "mbox"}
|
|
|
|
set sort = "${cfg.sort}"
|
|
|
|
|
|
|
|
# MTA section
|
|
|
|
${optionsStr (mtaSection account)}
|
|
|
|
|
|
|
|
${optionalString (cfg.checkStatsInterval != null) mailCheckSection}
|
|
|
|
|
|
|
|
${optionalString cfg.sidebar.enable sidebarSection}
|
|
|
|
|
|
|
|
# MRA section
|
|
|
|
${mraSection account}
|
|
|
|
|
|
|
|
# Extra configuration
|
|
|
|
${account.neomutt.extraConfig}
|
2023-01-10 09:35:00 +00:00
|
|
|
|
|
|
|
${signature}
|
2023-08-08 10:19:01 +00:00
|
|
|
''
|
|
|
|
+ optionalString (account.notmuch.enable && account.notmuch.neomutt.enable)
|
|
|
|
(notmuchSection account);
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
programs.neomutt = {
|
|
|
|
enable = mkEnableOption "the NeoMutt mail client";
|
|
|
|
|
2021-11-04 16:42:44 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.neomutt;
|
|
|
|
defaultText = literalExpression "pkgs.neomutt";
|
|
|
|
description = "The neomutt package to use.";
|
|
|
|
};
|
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
sidebar = mkOption {
|
|
|
|
type = sidebarModule;
|
|
|
|
default = { };
|
|
|
|
description = "Options related to the sidebar.";
|
|
|
|
};
|
|
|
|
|
|
|
|
binds = mkOption {
|
|
|
|
type = types.listOf bindModule;
|
|
|
|
default = [ ];
|
|
|
|
description = "List of keybindings.";
|
|
|
|
};
|
|
|
|
|
|
|
|
macros = mkOption {
|
|
|
|
type = types.listOf bindModule;
|
|
|
|
default = [ ];
|
|
|
|
description = "List of macros.";
|
|
|
|
};
|
|
|
|
|
|
|
|
sort = mkOption {
|
|
|
|
# allow users to choose any option from sortOptions, or any option prefixed with "reverse-"
|
|
|
|
type = types.enum
|
|
|
|
(sortOptions ++ (map (option: "reverse-" + option) sortOptions));
|
|
|
|
default = "threads";
|
|
|
|
description = "Sorting method on messages.";
|
|
|
|
};
|
|
|
|
|
|
|
|
vimKeys = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Enable vim-like bindings.";
|
|
|
|
};
|
|
|
|
|
|
|
|
checkStatsInterval = mkOption {
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
default = null;
|
|
|
|
example = 60;
|
|
|
|
description = "Enable and set the interval of automatic mail check.";
|
|
|
|
};
|
|
|
|
|
|
|
|
editor = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "$EDITOR";
|
|
|
|
description = "Select the editor used for writing mail.";
|
|
|
|
};
|
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = types.attrsOf types.str;
|
|
|
|
default = { };
|
|
|
|
description = "Extra configuration appended to the end.";
|
|
|
|
};
|
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
changeFolderWhenSourcingAccount =
|
|
|
|
mkEnableOption "changing the folder when sourcing an account" // {
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
2024-06-04 18:23:39 +00:00
|
|
|
sourcePrimaryAccount =
|
|
|
|
mkEnableOption "source the primary account by default" // {
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
unmailboxes = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Set `unmailboxes *` at the start of account configurations.
|
|
|
|
It removes previous sidebar mailboxes when sourcing an account configuration.
|
|
|
|
|
|
|
|
See <http://www.mutt.org/doc/manual/#mailboxes> for more information.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
|
|
|
description = "Extra configuration appended to the end.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
accounts.email.accounts = mkOption {
|
|
|
|
type = with types; attrsOf (submodule (import ./neomutt-accounts.nix));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2021-11-04 16:42:44 +00:00
|
|
|
home.packages = [ cfg.package ];
|
2020-10-12 00:22:58 +00:00
|
|
|
home.file = let
|
|
|
|
rcFile = account: {
|
|
|
|
"${accountFilename account}".text = accountStr account;
|
|
|
|
};
|
|
|
|
in foldl' (a: b: a // b) { } (map rcFile neomuttAccounts);
|
|
|
|
|
|
|
|
xdg.configFile."neomutt/neomuttrc" = mkIf (neomuttAccounts != [ ]) {
|
2021-07-02 22:36:30 +00:00
|
|
|
text = let
|
|
|
|
# Find the primary account, if it has neomutt enabled;
|
|
|
|
# otherwise use the first neomutt account as primary.
|
|
|
|
primary =
|
|
|
|
head (filter (a: a.primary) neomuttAccounts ++ neomuttAccounts);
|
2020-10-12 00:22:58 +00:00
|
|
|
in ''
|
|
|
|
# Generated by Home Manager.
|
|
|
|
set header_cache = "${config.xdg.cacheHome}/neomutt/headers/"
|
|
|
|
set message_cachedir = "${config.xdg.cacheHome}/neomutt/messages/"
|
|
|
|
set editor = "${cfg.editor}"
|
|
|
|
set implicit_autoview = yes
|
2024-06-04 18:23:39 +00:00
|
|
|
set crypt_use_gpgme = yes
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
alternative_order text/enriched text/plain text
|
|
|
|
|
|
|
|
set delete = yes
|
|
|
|
|
2024-06-04 18:23:39 +00:00
|
|
|
${optionalString cfg.vimKeys
|
|
|
|
"source ${pkgs.neomutt}/share/doc/neomutt/vim-keys/vim-keys.rc"}
|
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
# Binds
|
|
|
|
${bindSection}
|
|
|
|
|
|
|
|
# Macros
|
|
|
|
${macroSection}
|
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
# Register accounts
|
2024-06-04 18:23:39 +00:00
|
|
|
${
|
|
|
|
optionalString (accountCommandNeeded) ''
|
|
|
|
set account_command = '${accountCommand}/bin/account-command.sh'
|
|
|
|
''
|
|
|
|
}${concatMapStringsSep "\n" registerAccount neomuttAccounts}
|
2021-07-02 22:36:30 +00:00
|
|
|
|
2024-06-04 18:23:39 +00:00
|
|
|
${optionalString cfg.sourcePrimaryAccount ''
|
|
|
|
# Source primary account
|
|
|
|
source ${accountFilename primary}''}
|
2021-07-02 22:36:30 +00:00
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
# Extra configuration
|
|
|
|
${optionsStr cfg.settings}
|
|
|
|
|
|
|
|
${cfg.extraConfig}
|
2021-07-02 22:36:30 +00:00
|
|
|
'';
|
2020-10-12 00:22:58 +00:00
|
|
|
};
|
2021-07-02 22:36:30 +00:00
|
|
|
|
|
|
|
assertions = [{
|
|
|
|
assertion =
|
|
|
|
((filter (b: (length (toList b.map)) == 0) (cfg.binds ++ cfg.macros))
|
|
|
|
== [ ]);
|
|
|
|
message =
|
|
|
|
"The 'programs.neomutt.(binds|macros).map' list must contain at least one element.";
|
|
|
|
}];
|
|
|
|
|
|
|
|
warnings =
|
|
|
|
let hasOldBinds = binds: (filter (b: !(isList b.map)) binds) != [ ];
|
|
|
|
in mkIf (hasOldBinds (cfg.binds ++ cfg.macros)) [
|
|
|
|
"Specifying 'programs.neomutt.(binds|macros).map' as a string is deprecated, use a list of strings instead. See https://github.com/nix-community/home-manager/pull/1885."
|
|
|
|
];
|
2020-10-12 00:22:58 +00:00
|
|
|
};
|
|
|
|
}
|