From a7affc93ba4b68fb65927a5761e36667b09a4b4d Mon Sep 17 00:00:00 2001 From: David Guibert Date: Wed, 12 Dec 2018 14:28:33 +0100 Subject: [PATCH] msmtp: add extraConfig account option This patch allow to define custom msmtp options per email account. For example: to change the "auth" method from "on" to "login", add `msmtp.extraConfig.auth="login"`. --- modules/programs/msmtp-accounts.nix | 11 +++++++++++ modules/programs/msmtp.nix | 1 + 2 files changed, 12 insertions(+) diff --git a/modules/programs/msmtp-accounts.nix b/modules/programs/msmtp-accounts.nix index d4d4663f8..1730232da 100644 --- a/modules/programs/msmtp-accounts.nix +++ b/modules/programs/msmtp-accounts.nix @@ -21,5 +21,16 @@ with lib; primary account will be used. ''; }; + + extraConfig = mkOption { + type = types.attrsOf types.str; + default = { }; + example = { auth = "login"; }; + description = '' + Extra configuration options to add to ~/.msmtprc. + See for + examples. + ''; + }; }; } diff --git a/modules/programs/msmtp.nix b/modules/programs/msmtp.nix index 7f00bbb0a..b19c49863 100644 --- a/modules/programs/msmtp.nix +++ b/modules/programs/msmtp.nix @@ -31,6 +31,7 @@ let # msmtp requires the password to finish with a newline. passwordeval = ''${pkgs.bash}/bin/bash -c "${toString passwordCommand}; echo"''; } + // msmtp.extraConfig ) ++ optional primary "\naccount default : ${name}" );