Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/programs/aerc/accounts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ in
// optPwCmd "outgoing" passwordCommand;

msmtp = cfg: {
outgoing = "msmtpq --read-envelope-from --read-recipients";
outgoing = "${config.msmtp.msmtpCommand} --read-envelope-from --read-recipients";
};

};
Expand Down
5 changes: 4 additions & 1 deletion modules/programs/alot/accounts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ in

config = lib.mkIf config.notmuch.enable {
alot.sendMailCommand = lib.mkOptionDefault (
if config.msmtp.enable then "msmtpq --read-envelope-from --read-recipients" else null
if config.msmtp.enable then
"${config.msmtp.msmtpCommand} --read-envelope-from --read-recipients"
else
null
);
};
}
2 changes: 1 addition & 1 deletion modules/programs/astroid/accounts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

config = lib.mkIf config.notmuch.enable {
astroid.sendMailCommand = lib.mkIf config.msmtp.enable (
lib.mkOptionDefault "msmtpq --read-envelope-from --read-recipients"
lib.mkOptionDefault "${config.msmtp.msmtpCommand} --read-envelope-from --read-recipients"
);
};
}
19 changes: 18 additions & 1 deletion modules/programs/msmtp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ in
See <https://marlam.de/msmtp/msmtprc.txt> for examples.
'';
};

msmtpCommand = mkOption {
type = types.package;
internal = true;
readOnly = true;
default = if cfg.offlineSupport then "${pkgs.msmtp}/bin/msmtpq" else "${pkgs.msmtp}/bin/msmtp";
};

offlineSupport = lib.mkOption {
type = types.bool;
default = true;
description = ''
Use msmtpq script instead of msmtp. The script allows an offline
first workflow by adding all mails to a queue regardless of the
network status, and flushing them later.
'';
};
};

accounts.email.accounts = mkOption {
Expand All @@ -135,7 +152,7 @@ in
(lib.mkIf (cfg.extraAccounts != "") (lib.mkAfter cfg.extraAccounts))
];

home.sessionVariables = {
home.sessionVariables = lib.optionalAttrs cfg.offlineSupport {
MSMTPQ_Q = "${config.xdg.dataHome}/msmtp/queue";
MSMTPQ_LOG = "${config.xdg.dataHome}/msmtp/queue.log";
};
Expand Down
6 changes: 5 additions & 1 deletion modules/programs/neomutt/accounts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ in

sendMailCommand = mkOption {
type = types.nullOr types.str;
default = if config.msmtp.enable then "msmtpq --read-envelope-from --read-recipients" else null;
default =
if config.msmtp.enable then
"${config.msmtp.msmtpCommand} --read-envelope-from --read-recipients"
else
null;
defaultText = lib.literalExpression ''
if config.msmtp.enable then
"msmtpq --read-envelope-from --read-recipients"
Expand Down
Loading