neomutt: adding unmailboxes option

Adding unmailboxes option to neomutt, which adds the `unmailboxes`
option it to every account.email with neomutt enabled.

See https://www.mutt.org/doc/manual/#mailboxes for more.
This commit is contained in:
Philipp Kühn 2024-02-29 08:35:16 +01:00 committed by Robert Helgesson
parent 36f873dfc8
commit 017b12de5b
No known key found for this signature in database
GPG Key ID: 96E745BD17AA17ED
4 changed files with 82 additions and 1 deletions

View File

@ -296,7 +296,12 @@ let
pkgs.writeText "signature.txt" account.signature.text
}";
in ''
# Generated by Home Manager.
# Generated by Home Manager.${
optionalString cfg.unmailboxes ''
unmailboxes *
''
}
set ssl_force_tls = ${
lib.hm.booleans.yesNo (imap.tls.enable || imap.tls.useStartTls)
}
@ -397,6 +402,17 @@ in {
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.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";

View File

@ -14,4 +14,5 @@
neomutt-with-signature = ./neomutt-with-signature.nix;
neomutt-with-signature-command = ./neomutt-with-signature-command.nix;
neomutt-with-starttls = ./neomutt-with-starttls.nix;
neomutt-unmailboxes = ./neomutt-unmailboxes.nix;
}

View File

@ -0,0 +1,34 @@
# Generated by Home Manager.
unmailboxes *
set ssl_force_tls = yes
set certificate_file=/etc/ssl/certs/ca-certificates.crt
# GPG section
set crypt_autosign = no
set crypt_opportunistic_encrypt = no
set pgp_use_gpg_agent = yes
set mbox_type = Maildir
set sort = "threads"
# MTA section
set sendmail='msmtpq --read-envelope-from --read-recipients'
# MRA section
set folder='/home/hm-user/Mail/hm@example.com'
set from='hm@example.com'
set postponed='+Drafts'
set realname='H. M. Test'
set record='+Sent'
set spoolfile='+Inbox'
set trash='+Trash'
# Extra configuration
unset signature

View File

@ -0,0 +1,30 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
config = {
accounts.email.accounts = {
"hm@example.com" = {
msmtp.enable = true;
neomutt.enable = true;
imap.port = 993;
};
};
programs.neomutt.enable = true;
programs.neomutt.unmailboxes = true;
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/hm@example.com
assertFileContent home-files/.config/neomutt/hm@example.com ${
./hm-example.com-unmailboxes-expected.conf
}
'';
};
}