1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-29 01:48:31 +02:00
home-manager/tests/modules/programs/neomutt/neomutt-with-binds-with-warning.nix
Sumner Evans 25a6a6d298
neomutt: support list in binds.map (#1885)
* neomutt: support list in binds.map
Closes #1245

Adds support for specifying programs.neomutt.binds[].map as a list. If
specified as a list, then the binds will be concatenated with a ",".

* neomutt: add deprecation warning for (binds|macros).map as string
Added note that specifying 'programs.neomutt.(binds|macros).map' as a string is deprecated. Instead, use the list form.

* neomutt: note deprecation warning in release notes
Added note that specifying 'programs.neomutt.(binds|macros).map' as a
single string is deprecated in favor of specifying it as a list

* neomutt: add assertion that map is not empty
Added an assertion that each 'programs.neomutt.(binds|macros).map' list contains at least one element.
2021-04-04 01:47:40 +02:00

72 lines
1.7 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
config = {
accounts.email.accounts = {
"hm@example.com" = {
notmuch.enable = true;
neomutt = {
enable = true;
extraConfig = ''
color status cyan default
'';
};
imap.port = 993;
};
};
programs.neomutt = {
enable = true;
vimKeys = false;
binds = [
{
action = "complete-query";
key = "<Tab>";
map = "editor";
}
{
action = "sidebar-prev";
key = "\\Cp";
map = [ "index" "pager" ];
}
];
macros = [
{
action = "<save-message>?<tab>";
key = "s";
map = "index";
}
{
action = "<change-folder>?<change-dir><home>^K=<enter><tab>";
key = "c";
map = [ "index" "pager" ];
}
];
};
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.asserts.warnings.expected = [
"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."
];
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc
assertFileExists home-files/.config/neomutt/hm@example.com
assertFileContent home-files/.config/neomutt/neomuttrc ${
./neomutt-with-binds-expected.conf
}
assertFileContent home-files/.config/neomutt/hm@example.com ${
./hm-example.com-expected
}
'';
};
}