summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2019-08-13 15:35:12 +0200
committerlassulus <lassulus@lassul.us>2019-08-13 15:35:12 +0200
commit0699b41b05a1f9cd133c15c3aadf70c3a45170f6 (patch)
tree0bdd752d8a9ec64acb12ff160826a19b2e11e95c /krebs
parente754ced01e2d5ef84dabba391bba2f372694b7cb (diff)
parent681075a8f41ecfbac4c113481adde4d61f497c36 (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'krebs')
-rw-r--r--krebs/3modules/urlwatch.nix46
1 files changed, 32 insertions, 14 deletions
diff --git a/krebs/3modules/urlwatch.nix b/krebs/3modules/urlwatch.nix
index 0cec1a2d..61ee72e7 100644
--- a/krebs/3modules/urlwatch.nix
+++ b/krebs/3modules/urlwatch.nix
@@ -16,7 +16,6 @@ let
api = {
enable = mkEnableOption "krebs.urlwatch";
-
dataDir = mkOption {
type = types.str;
default = "/var/lib/urlwatch";
@@ -54,6 +53,18 @@ let
The format is described in systemd.time(7), CALENDAR EVENTS.
'';
};
+ sendmail.enable = mkEnableOption "krebs.urlwatch.sendmail" // {
+ default = true;
+ };
+ telegram = {
+ enable = mkEnableOption "krebs.urlwatch.telegram";
+ botToken = mkOption {
+ type = types.str;
+ };
+ chatId = mkOption {
+ type = types.listOf types.str;
+ };
+ };
urls = mkOption {
type = with types; listOf (either str subtypes.job);
default = [];
@@ -110,6 +121,11 @@ let
color = true;
enabled = true;
};
+ ${if cfg.telegram.enable then "telegram" else null} = {
+ enabled = cfg.telegram.enable;
+ bot_token = cfg.telegram.botToken;
+ chat_id = cfg.telegram.chatId;
+ };
text = {
details = true;
footer = true;
@@ -158,19 +174,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.sendmail.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
+ ''}
'';
};
};