summaryrefslogtreecommitdiffstats
path: root/krebs/3modules
diff options
context:
space:
mode:
authorKierán Meinhardt <kieran.meinhardt@gmail.com>2019-07-09 20:29:41 +0200
committerKierán Meinhardt <kieran.meinhardt@gmail.com>2019-07-09 20:48:56 +0200
commit41a49361440522529f9a74e5fd37dc3a5c4f2bd0 (patch)
treea7e4f9002b92595683fcca7f601cdf0d821be0b8 /krebs/3modules
parent1d23dceb5d2c536790a00fcde30743b958f1018f (diff)
urlwatch: optionalise custom sendmail
Diffstat (limited to 'krebs/3modules')
-rw-r--r--krebs/3modules/urlwatch.nix30
1 files changed, 17 insertions, 13 deletions
diff --git a/krebs/3modules/urlwatch.nix b/krebs/3modules/urlwatch.nix
index 0cec1a2d..3213080d 100644
--- a/krebs/3modules/urlwatch.nix
+++ b/krebs/3modules/urlwatch.nix
@@ -17,6 +17,8 @@ let
api = {
enable = mkEnableOption "krebs.urlwatch";
+ customSendmail.enable = mkEnableOption "krebs.urlwatch.customSendmail";
+
dataDir = mkOption {
type = types.str;
default = "/var/lib/urlwatch";
@@ -158,19 +160,21 @@ let
--urls=${shell.escape urlsFile} \
> changes || :
- if test -s changes; then
- {
- echo Date: $(date -R)
- echo From: ${shell.escape cfg.from}
- echo Subject: $(
- sed -n 's/^\(CHANGED\|ERROR\|NEW\): //p' changes \
- | tr '\n' ' '
- )
- echo To: ${shell.escape cfg.mailto}
- echo
- cat changes
- } | /run/wrappers/bin/sendmail -t
- fi
+ ${optionalString cfg.customSendmail.enable /* sh */ ''
+ if test -s changes; then
+ {
+ echo Date: $(date -R)
+ echo From: ${shell.escape cfg.from}
+ echo Subject: $(
+ sed -n 's/^\(CHANGED\|ERROR\|NEW\): //p' changes \
+ | tr '\n' ' '
+ )
+ echo To: ${shell.escape cfg.mailto}
+ echo
+ cat changes
+ } | /run/wrappers/bin/sendmail -t
+ fi
+ ''}
'';
};
};