1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00: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:
Sumner Evans 2021-04-12 11:25:02 -06:00 committed by Robert Helgesson
parent cdc774f337
commit 225bf275ba
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 70 additions and 3 deletions

View file

@ -124,9 +124,10 @@ let
genMaildirAccountConfig = account:
with account;
let
folderHook = mapAttrsToList setOption (genCommonFolderHooks account // {
folder = "'${account.maildir.absPath}'";
});
folderHook = mapAttrsToList setOption (genCommonFolderHooks account
// optionalAttrs cfg.changeFolderWhenSourcingAccount {
folder = "'${account.maildir.absPath}'";
});
in ''
${concatStringsSep "\n" folderHook}
'';
@ -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 = "";

View file

@ -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;
}

View file

@ -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

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.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
}
'';
};
}