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:
parent
2d057cd9d4
commit
c4d5d72805
22 changed files with 82 additions and 169 deletions
|
|
@ -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}
|
||||
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,11 +325,8 @@ let
|
|||
|
||||
# MTA section
|
||||
${optionsStr (mtaSection account)}
|
||||
|
||||
${optionalString (cfg.checkStatsInterval != null) mailCheckSection}
|
||||
|
||||
${optionalString cfg.sidebar.enable sidebarSection}
|
||||
|
||||
''] ++ (lib.optional (cfg.checkStatsInterval != null) mailCheckSection)
|
||||
++ (lib.optional cfg.sidebar.enable sidebarSection) ++ [''
|
||||
# MRA section
|
||||
${mraSection account}
|
||||
|
||||
|
|
@ -335,9 +334,9 @@ let
|
|||
${account.neomutt.extraConfig}
|
||||
|
||||
${signature}
|
||||
''
|
||||
+ optionalString (account.notmuch.enable && account.notmuch.neomutt.enable)
|
||||
(notmuchSection account);
|
||||
'']
|
||||
++ 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
|
||||
|
||||
alternative_order text/enriched text/plain text
|
||||
|
||||
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'
|
||||
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 != [ ]) [
|
||||
''
|
||||
}${concatMapStringsSep "\n" registerAccount neomuttAccounts}
|
||||
|
||||
${optionalString cfg.sourcePrimaryAccount ''
|
||||
# Binds''
|
||||
bindSection
|
||||
]) ++ [
|
||||
''
|
||||
|
||||
# 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 = [{
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ set sort = "threads"
|
|||
set smtp_pass="`password-command`"
|
||||
set smtp_url='smtps://home.manager@smtp.example.com'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# MRA section
|
||||
set folder='/home/hm-user/Mail/hm@example.com'
|
||||
set from='hm@example.com'
|
||||
|
|
@ -32,6 +28,7 @@ color status cyan default
|
|||
|
||||
|
||||
unset signature
|
||||
|
||||
# notmuch section
|
||||
set nm_default_uri = "notmuch:///home/hm-user/Mail"
|
||||
virtual-mailboxes "My INBOX" "notmuch://?query=tag%3Ainbox"
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ set sort = "threads"
|
|||
set smtp_pass="`password-command`"
|
||||
set smtp_url='smtps://home.manager@smtp.example.com'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# MRA section
|
||||
set folder='/home/hm-user/Mail/hm@example.com'
|
||||
set from='hm@example.com'
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ set sort = "threads"
|
|||
set smtp_pass="`password-command`"
|
||||
set smtp_url='smtps://home.manager@smtp.example.com'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# MRA section
|
||||
set folder='imaps://home.manager@imap.example.com:993'
|
||||
set from='hm@example.com'
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ 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'
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ set sort = "threads"
|
|||
# MTA section
|
||||
set sendmail='msmtpq --read-envelope-from --read-recipients'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# MRA section
|
||||
set from='hm@example.com'
|
||||
set postponed='+Drafts'
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ set sort = "threads"
|
|||
set smtp_pass="`password-command`"
|
||||
set smtp_url='smtps://home.manager@smtp.example.com'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# MRA section
|
||||
set folder='/home/hm-user/Mail/hm@example.com'
|
||||
set from='hm@example.com'
|
||||
|
|
@ -32,6 +28,7 @@ color status cyan default
|
|||
|
||||
|
||||
set signature = "/nix/store/00000000000000000000000000000000-signature|"
|
||||
|
||||
# notmuch section
|
||||
set nm_default_uri = "notmuch:///home/hm-user/Mail"
|
||||
virtual-mailboxes "My INBOX" "notmuch://?query=tag%3Ainbox"
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ set sort = "threads"
|
|||
set smtp_pass="`password-command`"
|
||||
set smtp_url='smtps://home.manager@smtp.example.com'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# MRA section
|
||||
set folder='/home/hm-user/Mail/hm@example.com'
|
||||
set from='hm@example.com'
|
||||
|
|
@ -32,6 +28,7 @@ color status cyan default
|
|||
|
||||
|
||||
set signature = /nix/store/00000000000000000000000000000000-signature.txt
|
||||
|
||||
# notmuch section
|
||||
set nm_default_uri = "notmuch:///home/hm-user/Mail"
|
||||
virtual-mailboxes "My INBOX" "notmuch://?query=tag%3Ainbox"
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ set sort = "threads"
|
|||
set smtp_pass="`password-command`"
|
||||
set smtp_url='smtp://home.manager@smtp.example.com'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# MRA section
|
||||
set folder='/home/hm-user/Mail/hm@example.com'
|
||||
set from='hm@example.com'
|
||||
|
|
@ -32,6 +28,7 @@ color status cyan default
|
|||
|
||||
|
||||
unset signature
|
||||
|
||||
# notmuch section
|
||||
set nm_default_uri = "notmuch:///home/hm-user/Mail"
|
||||
virtual-mailboxes "My INBOX" "notmuch://?query=tag%3Ainbox"
|
||||
|
|
|
|||
|
|
@ -14,10 +14,6 @@ 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'
|
||||
|
|
|
|||
|
|
@ -4,31 +4,22 @@ set message_cachedir = "/home/hm-user/.cache/neomutt/messages/"
|
|||
set editor = "$EDITOR"
|
||||
set implicit_autoview = yes
|
||||
set crypt_use_gpgme = yes
|
||||
|
||||
alternative_order text/enriched text/plain text
|
||||
|
||||
set delete = yes
|
||||
|
||||
|
||||
|
||||
# Binds
|
||||
|
||||
|
||||
# Macros
|
||||
|
||||
|
||||
# Register accounts
|
||||
# register account hm@example.com
|
||||
|
||||
## register account hm@example.com
|
||||
mailboxes "/home/hm-user/Mail/hm@example.com/Inbox"
|
||||
|
||||
folder-hook /home/hm-user/Mail/hm@example.com/ " \
|
||||
source /home/hm-user/.config/neomutt/hm@example.com "
|
||||
|
||||
|
||||
# Source primary account
|
||||
source /home/hm-user/.config/neomutt/hm@example.com
|
||||
|
||||
# Extra configuration
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,31 +4,22 @@ set message_cachedir = "/home/hm-user/.cache/neomutt/messages/"
|
|||
set editor = "$EDITOR"
|
||||
set implicit_autoview = yes
|
||||
set crypt_use_gpgme = yes
|
||||
|
||||
alternative_order text/enriched text/plain text
|
||||
|
||||
set delete = yes
|
||||
|
||||
|
||||
|
||||
# Binds
|
||||
|
||||
|
||||
# Macros
|
||||
|
||||
|
||||
# Register accounts
|
||||
# register account hm-account
|
||||
|
||||
## register account hm-account
|
||||
mailboxes "/home/hm-user/Mail/hm-account/Inbox"
|
||||
|
||||
folder-hook /home/hm-user/Mail/hm-account/ " \
|
||||
source /home/hm-user/.config/neomutt/hm-account "
|
||||
|
||||
|
||||
# Source primary account
|
||||
source /home/hm-user/.config/neomutt/hm-account
|
||||
|
||||
# Extra configuration
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/neomutt/neomuttrc
|
||||
assertFileContent home-files/.config/neomutt/neomuttrc ${
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${
|
||||
./neomutt-not-primary-expected.conf
|
||||
}
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -4,13 +4,10 @@ set message_cachedir = "/home/hm-user/.cache/neomutt/messages/"
|
|||
set editor = "$EDITOR"
|
||||
set implicit_autoview = yes
|
||||
set crypt_use_gpgme = yes
|
||||
|
||||
alternative_order text/enriched text/plain text
|
||||
|
||||
set delete = yes
|
||||
|
||||
|
||||
|
||||
# Binds
|
||||
bind editor <Tab> "complete-query"
|
||||
bind index,pager \Cp "sidebar-prev"
|
||||
|
|
@ -18,19 +15,16 @@ bind index,pager \Cp "sidebar-prev"
|
|||
# Macros
|
||||
macro index s "<save-message>?<tab>"
|
||||
macro index,pager c "<change-folder>?<change-dir><home>^K=<enter><tab>"
|
||||
|
||||
# Register accounts
|
||||
# register account hm@example.com
|
||||
|
||||
## register account hm@example.com
|
||||
mailboxes "/home/hm-user/Mail/hm@example.com/Inbox"
|
||||
|
||||
folder-hook /home/hm-user/Mail/hm@example.com/ " \
|
||||
source /home/hm-user/.config/neomutt/hm@example.com "
|
||||
|
||||
|
||||
# Source primary account
|
||||
source /home/hm-user/.config/neomutt/hm@example.com
|
||||
|
||||
# Extra configuration
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.config/neomutt/neomuttrc
|
||||
assertFileExists home-files/.config/neomutt/hm@example.com
|
||||
assertFileContent home-files/.config/neomutt/neomuttrc ${
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${
|
||||
./neomutt-with-binds-expected.conf
|
||||
}
|
||||
assertFileContent home-files/.config/neomutt/hm@example.com ${
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/neomutt/hm@example.com) ${
|
||||
./hm-example.com-expected
|
||||
}
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.config/neomutt/neomuttrc
|
||||
assertFileExists home-files/.config/neomutt/hm@example.com
|
||||
assertFileContent home-files/.config/neomutt/neomuttrc ${
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${
|
||||
./neomutt-with-binds-expected.conf
|
||||
}
|
||||
assertFileContent home-files/.config/neomutt/hm@example.com ${
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/neomutt/hm@example.com) ${
|
||||
./hm-example.com-expected
|
||||
}
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.config/neomutt/neomuttrc
|
||||
assertFileExists home-files/.config/neomutt/hm@example.com
|
||||
assertFileContent home-files/.config/neomutt/neomuttrc ${
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${
|
||||
./neomutt-expected.conf
|
||||
}
|
||||
assertFileContent home-files/.config/neomutt/hm@example.com ${
|
||||
|
|
|
|||
|
|
@ -4,32 +4,23 @@ set message_cachedir = "/home/hm-user/.cache/neomutt/messages/"
|
|||
set editor = "$EDITOR"
|
||||
set implicit_autoview = yes
|
||||
set crypt_use_gpgme = yes
|
||||
|
||||
alternative_order text/enriched text/plain text
|
||||
|
||||
set delete = yes
|
||||
|
||||
|
||||
|
||||
# Binds
|
||||
|
||||
|
||||
# Macros
|
||||
|
||||
|
||||
# Register accounts
|
||||
set account_command = '/nix/store/00000000000000000000000000000000-account-command.sh/bin/account-command.sh'
|
||||
# register account hm@example.com
|
||||
|
||||
## register account hm@example.com
|
||||
mailboxes "imaps://home.manager@imap.example.com:993/Inbox"
|
||||
|
||||
account-hook imaps://home.manager@imap.example.com:993/ " \
|
||||
source /home/hm-user/.config/neomutt/hm@example.com "
|
||||
|
||||
|
||||
# Source primary account
|
||||
source /home/hm-user/.config/neomutt/hm@example.com
|
||||
|
||||
# Extra configuration
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,22 +4,16 @@ set message_cachedir = "/home/hm-user/.cache/neomutt/messages/"
|
|||
set editor = "$EDITOR"
|
||||
set implicit_autoview = yes
|
||||
set crypt_use_gpgme = yes
|
||||
|
||||
alternative_order text/enriched text/plain text
|
||||
|
||||
set delete = yes
|
||||
|
||||
|
||||
|
||||
# Binds
|
||||
|
||||
|
||||
# Macros
|
||||
|
||||
|
||||
# Register accounts
|
||||
set account_command = '/nix/store/00000000000000000000000000000000-account-command.sh/bin/account-command.sh'
|
||||
# register account hm@example.com
|
||||
|
||||
## register account hm@example.com
|
||||
named-mailboxes "someCustomName" "/home/hm-user/Mail/hm@example.com/Inbox"
|
||||
mailboxes "/home/hm-user/Mail/hm@example.com/Sent"
|
||||
named-mailboxes "Spam" "imaps://home.manager@imap.example.com:993/Junk Email"
|
||||
|
|
@ -27,11 +21,8 @@ mailboxes "/home/hm-user/Mail/hm@example.com/Trash"
|
|||
folder-hook /home/hm-user/Mail/hm@example.com/ " \
|
||||
source /home/hm-user/.config/neomutt/hm@example.com "
|
||||
|
||||
|
||||
# Source primary account
|
||||
source /home/hm-user/.config/neomutt/hm@example.com
|
||||
|
||||
# Extra configuration
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,21 +4,15 @@ set message_cachedir = "/home/hm-user/.cache/neomutt/messages/"
|
|||
set editor = "$EDITOR"
|
||||
set implicit_autoview = yes
|
||||
set crypt_use_gpgme = yes
|
||||
|
||||
alternative_order text/enriched text/plain text
|
||||
|
||||
set delete = yes
|
||||
|
||||
|
||||
|
||||
# Binds
|
||||
|
||||
|
||||
# Macros
|
||||
|
||||
|
||||
# Register accounts
|
||||
# register account hm@example.com
|
||||
|
||||
## register account hm@example.com
|
||||
named-mailboxes "someCustomName" "/home/hm-user/Mail/hm@example.com/Inbox"
|
||||
mailboxes "/home/hm-user/Mail/hm@example.com/Sent"
|
||||
named-mailboxes "Spam" "/home/hm-user/Mail/hm@example.com/Junk Email"
|
||||
|
|
@ -26,11 +20,8 @@ mailboxes "/home/hm-user/Mail/hm@example.com/Trash"
|
|||
folder-hook /home/hm-user/Mail/hm@example.com/ " \
|
||||
source /home/hm-user/.config/neomutt/hm@example.com "
|
||||
|
||||
|
||||
# Source primary account
|
||||
source /home/hm-user/.config/neomutt/hm@example.com
|
||||
|
||||
# Extra configuration
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.config/neomutt/neomuttrc
|
||||
assertFileExists home-files/.config/neomutt/hm@example.com
|
||||
assertFileContent home-files/.config/neomutt/neomuttrc ${
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${
|
||||
./neomutt-with-named-mailboxes-expected.conf
|
||||
}
|
||||
assertFileContent home-files/.config/neomutt/hm@example.com ${
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.config/neomutt/neomuttrc
|
||||
assertFileExists home-files/.config/neomutt/hm@example.com
|
||||
assertFileContent home-files/.config/neomutt/neomuttrc ${
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${
|
||||
./neomutt-expected.conf
|
||||
}
|
||||
expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue