aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/programs/msmtp.nix
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-02-03 10:05:30 +0100
committerKatharina Fey <kookie@spacekookie.de>2020-02-03 10:05:30 +0100
commitc488527c95c874d3b8743c915173ad7bfb05d5af (patch)
tree2b874dc5606a9dff44096a5e8557f00dc52ac2b6 /home-manager/modules/programs/msmtp.nix
parent899a451e08f7d6d2c8214d119c2a0316849a0ed4 (diff)
parent6cc4fd6ede4909226cb81d3475834251ed1b7210 (diff)
Merge commit '6cc4fd6ede4909226cb81d3475834251ed1b7210'
Diffstat (limited to 'home-manager/modules/programs/msmtp.nix')
-rw-r--r--home-manager/modules/programs/msmtp.nix54
1 files changed, 23 insertions, 31 deletions
diff --git a/home-manager/modules/programs/msmtp.nix b/home-manager/modules/programs/msmtp.nix
index 1ff3139ef36..f34fd72f8b1 100644
--- a/home-manager/modules/programs/msmtp.nix
+++ b/home-manager/modules/programs/msmtp.nix
@@ -6,38 +6,32 @@ let
cfg = config.programs.msmtp;
- msmtpAccounts = filter (a: a.msmtp.enable)
- (attrValues config.accounts.email.accounts);
+ msmtpAccounts =
+ filter (a: a.msmtp.enable) (attrValues config.accounts.email.accounts);
onOff = p: if p then "on" else "off";
- accountStr = account: with account;
- concatStringsSep "\n" (
- [ "account ${name}" ]
- ++ mapAttrsToList (n: v: n + " " + v) (
- {
- host = smtp.host;
- from = address;
- auth = "on";
- user = userName;
- tls = onOff smtp.tls.enable;
- tls_starttls = onOff smtp.tls.useStartTls;
- tls_trust_file = smtp.tls.certificatesFile;
- }
- // optionalAttrs (msmtp.tls.fingerprint != null) {
- tls_fingerprint = msmtp.tls.fingerprint;
- }
- // optionalAttrs (smtp.port != null) {
- port = toString smtp.port;
- }
+ accountStr = account:
+ with account;
+ concatStringsSep "\n" ([ "account ${name}" ]
+ ++ mapAttrsToList (n: v: n + " " + v) ({
+ host = smtp.host;
+ from = address;
+ auth = "on";
+ user = userName;
+ tls = onOff smtp.tls.enable;
+ tls_starttls = onOff smtp.tls.useStartTls;
+ tls_trust_file = smtp.tls.certificatesFile;
+ } // optionalAttrs (msmtp.tls.fingerprint != null) {
+ tls_fingerprint = msmtp.tls.fingerprint;
+ } // optionalAttrs (smtp.port != null) { port = toString smtp.port; }
// optionalAttrs (passwordCommand != null) {
# 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}"
- );
+ passwordeval =
+ ''${pkgs.bash}/bin/bash -c "${toString passwordCommand}; echo"'';
+ } // msmtp.extraConfig) ++ optional primary ''
+
+ account default : ${name}'');
configFile = mailAccounts: ''
# Generated by Home Manager.
@@ -47,9 +41,7 @@ let
${concatStringsSep "\n\n" (map accountStr mailAccounts)}
'';
-in
-
-{
+in {
options = {
programs.msmtp = {
@@ -71,7 +63,7 @@ in
xdg.configFile."msmtp/config".text = configFile msmtpAccounts;
- home.sessionVariables = {
+ home.sessionVariables = {
MSMTP_QUEUE = "${config.xdg.dataHome}/msmtp/queue";
MSMTP_LOG = "${config.xdg.dataHome}/msmtp/queue.log";
};