1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-06 17:11:03 +01:00

neomutt: remove empty lines (#6523)

* neomutt: remove empty lines

prettier + more readable
made some tests easier to update by printing full path
This commit is contained in:
Matthieu Coudron 2025-03-24 22:18:52 +01:00 committed by GitHub
parent 2d057cd9d4
commit c4d5d72805
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 82 additions and 169 deletions

View file

@ -237,14 +237,16 @@ let
else
''named-mailboxes "${extra.name}" "${mailboxroot}/${extra.mailbox}"'')
account.neomutt.extraMailboxes;
in with account; ''
# register account ${name}
${optionalString account.neomutt.showDefaultMailbox
''${mailboxes} "${mailroot}/${folders.inbox}"''}
${extraMailboxes}
${hookName} ${mailroot}/ " \
source ${accountFilename account} "
'';
in with account;
[ "## register account ${name}" ]
++ optional account.neomutt.showDefaultMailbox
''${mailboxes} "${mailroot}/${folders.inbox}"'' ++ [
extraMailboxes
''
${hookName} ${mailroot}/ " \
source ${accountFilename account} "
''
];
mraSection = account:
with account;
@ -300,7 +302,7 @@ let
"set signature = ${
pkgs.writeText "signature.txt" account.signature.text
}";
in ''
in concatStringsSep "\n" ([''
# Generated by Home Manager.${
optionalString cfg.unmailboxes ''
@ -323,21 +325,18 @@ let
# MTA section
${optionsStr (mtaSection account)}
''] ++ (lib.optional (cfg.checkStatsInterval != null) mailCheckSection)
++ (lib.optional cfg.sidebar.enable sidebarSection) ++ [''
# MRA section
${mraSection account}
${optionalString (cfg.checkStatsInterval != null) mailCheckSection}
# Extra configuration
${account.neomutt.extraConfig}
${optionalString cfg.sidebar.enable sidebarSection}
# MRA section
${mraSection account}
# Extra configuration
${account.neomutt.extraConfig}
${signature}
''
+ optionalString (account.notmuch.enable && account.notmuch.neomutt.enable)
(notmuchSection account);
${signature}
'']
++ lib.optional (account.notmuch.enable && account.notmuch.neomutt.enable)
(notmuchSection account));
in {
options = {
@ -454,43 +453,40 @@ in {
# otherwise use the first neomutt account as primary.
primary =
head (filter (a: a.primary) neomuttAccounts ++ neomuttAccounts);
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
set crypt_use_gpgme = yes
in concatStringsSep "\n" ([
"# 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"
"set crypt_use_gpgme = yes"
"alternative_order text/enriched text/plain text"
"set delete = yes"
(optionalString cfg.vimKeys
"source ${pkgs.neomutt}/share/doc/neomutt/vim-keys/vim-keys.rc")
] ++ (lib.optionals (cfg.binds != [ ]) [
''
alternative_order text/enriched text/plain text
# Binds''
bindSection
]) ++ [
''
set delete = yes
${optionalString cfg.vimKeys
"source ${pkgs.neomutt}/share/doc/neomutt/vim-keys/vim-keys.rc"}
# Binds
${bindSection}
# Macros
${macroSection}
# Register accounts
${
optionalString (accountCommandNeeded) ''
set account_command = '${accountCommand}/bin/account-command.sh'
''
}${concatMapStringsSep "\n" registerAccount neomuttAccounts}
${optionalString cfg.sourcePrimaryAccount ''
# Macros''
macroSection
"# Register accounts"
(optionalString (accountCommandNeeded) ''
set account_command = '${accountCommand}/bin/account-command.sh'
'')
] ++ (lib.flatten (map registerAccount neomuttAccounts)) ++ [
(optionalString cfg.sourcePrimaryAccount ''
# Source primary account
source ${accountFilename primary}''}
# Extra configuration
${optionsStr cfg.settings}
${cfg.extraConfig}
'';
source ${accountFilename primary}
'')
"# Extra configuration"
(optionsStr cfg.settings)
cfg.extraConfig
]);
};
assertions = [{