mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
neomutt: make folder change when sourcing account optional
This adds an option for disabling setting the folder when sourcing accounts in neomutt.
This commit is contained in:
parent
cdc774f337
commit
225bf275ba
4 changed files with 70 additions and 3 deletions
|
@ -124,7 +124,8 @@ let
|
|||
genMaildirAccountConfig = account:
|
||||
with account;
|
||||
let
|
||||
folderHook = mapAttrsToList setOption (genCommonFolderHooks account // {
|
||||
folderHook = mapAttrsToList setOption (genCommonFolderHooks account
|
||||
// optionalAttrs cfg.changeFolderWhenSourcingAccount {
|
||||
folder = "'${account.maildir.absPath}'";
|
||||
});
|
||||
in ''
|
||||
|
@ -266,6 +267,11 @@ in {
|
|||
description = "Extra configuration appended to the end.";
|
||||
};
|
||||
|
||||
changeFolderWhenSourcingAccount =
|
||||
mkEnableOption "changing the folder when sourcing an account" // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
neomutt-with-binds-invalid-settings =
|
||||
./neomutt-with-binds-invalid-settings.nix;
|
||||
neomutt-with-gpg = ./neomutt-with-gpg.nix;
|
||||
neomutt-no-folder-change = ./neomutt-no-folder-change.nix;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# Generated by Home Manager.
|
||||
set ssl_force_tls = yes
|
||||
set certificate_file=/etc/ssl/certs/ca-certificates.crt
|
||||
|
||||
# GPG section
|
||||
set crypt_use_gpgme = yes
|
||||
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 from='hm@example.com'
|
||||
set postponed='+Drafts'
|
||||
set realname='H. M. Test'
|
||||
set record='+Sent'
|
||||
set spoolfile='+Inbox'
|
||||
set trash='+Trash'
|
||||
|
||||
|
||||
# Extra configuration
|
||||
|
30
tests/modules/programs/neomutt/neomutt-no-folder-change.nix
Normal file
30
tests/modules/programs/neomutt/neomutt-no-folder-change.nix
Normal 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.changeFolderWhenSourcingAccount = false;
|
||||
|
||||
nixpkgs.overlays =
|
||||
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/neomutt/hm@example.com
|
||||
assertFileContent home-files/.config/neomutt/hm@example.com ${
|
||||
./hm-example.com-no-folder-change-expected.conf
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue