From 0d110a0936e865c208e0188adc43aae42b7989e0 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 18 Oct 2021 08:42:13 +0200 Subject: [PATCH] imapnotify: only write onNew* if a value is available --- modules/services/imapnotify.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/services/imapnotify.nix b/modules/services/imapnotify.nix index 5d7c5f4b..209dc315 100644 --- a/modules/services/imapnotify.nix +++ b/modules/services/imapnotify.nix @@ -44,17 +44,19 @@ let 143; toJSON = builtins.toJSON; - in toJSON { + in toJSON ({ inherit (account.imap) host; inherit port; tls = account.imap.tls.enable; username = account.userName; passwordCmd = lib.concatMapStringsSep " " lib.escapeShellArg account.passwordCommand; - onNewMail = account.imapnotify.onNotify; - onNewMailPost = account.imapnotify.onNotifyPost; inherit (account.imapnotify) boxes; - }); + } // optionalAttrs (account.imapnotify.onNotify != "") { + onNewMail = account.imapnotify.onNotify; + } // optionalAttrs (account.imapnotify.onNotifyPost != "") { + onNewMailPost = account.imapnotify.onNotifyPost; + })); in { meta.maintainers = [ maintainers.nickhu ];