neomutt: fix sendMailCommand when msmtp is enabled

This resolves the error

    The option `accounts.email.accounts.xyz.neomutt.sendMailCommand`
    is defined both null and not null, in
    `…/home-manager/modules/accounts/email.nix' and
    `…/home-manager/modules/accounts/email.nix'.

that would occur previously when both neomutt and msmtp were enabled
for an account.
This commit is contained in:
Robert Helgesson 2020-02-16 23:08:37 +01:00
parent 7a3e2cc063
commit 5be9aa417a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 91 additions and 9 deletions

View file

@ -8,7 +8,16 @@ with lib;
sendMailCommand = mkOption {
type = types.nullOr types.str;
default = null;
default = if config.msmtp.enable then
"msmtpq --read-envelope-from --read-recipients"
else
null;
defaultText = literalExample ''
if config.msmtp.enable then
"msmtpq --read-envelope-from --read-recipients"
else
null
'';
example = "msmtpq --read-envelope-from --read-recipients";
description = ''
Command to send a mail. If not set, neomutt will be in charge of sending mails.
@ -24,11 +33,4 @@ with lib;
'';
};
};
config = mkIf config.neomutt.enable {
neomutt.sendMailCommand = mkOptionDefault (if config.msmtp.enable then
"msmtpq --read-envelope-from --read-recipients"
else
null);
};
}