1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/urlwatch.nix

155 lines
4.5 KiB
Nix
Raw Normal View History

2020-11-05 21:29:20 +01:00
{ pkgs, config, lib, ... }:
let
inherit (import <niveum/lib>) kieran;
urlwatchDir = "/var/lib/urlwatch";
urlsFile = pkgs.writeText "urls" (builtins.concatStringsSep "\n---\n" (map builtins.toJSON urls));
urls = [
{
name = "Corona-Verordnung";
url = "https://www.berlin.de/corona/massnahmen/verordnung/";
2021-03-30 12:25:12 +02:00
filter = [ { css = "[role=main]"; } "html2text" "strip" ];
}
{
name = "HU Semester";
url = "https://agnes.hu-berlin.de/lupo/rds?state=change&type=6&moduleParameter=semesterSelect&nextdir=change&next=SearchSelect.vm&subdir=applications&targettype=7&targetstate=change&getglobal=semester";
2021-03-30 12:25:12 +02:00
filter = [ { css = "fieldset"; } "html2text" "strip" ];
}
2021-09-05 15:51:39 +02:00
{
name = "Lammla 2021";
url = "http://lammla.info/index.php?reihe=30";
filter = [ "html2text" "strip" ];
}
2021-09-14 14:59:09 +02:00
{
name = "Tatort";
url = "https://www.daserste.de/unterhaltung/krimi/tatort/vorschau/index.html";
filter = [
"html2text"
"strip"
{
shellpipe = ''
${pkgs.gnused}/bin/sed 's/&#32;/ /g;s/))/&\n/g;s/ \+/ /g'
'';
}
];
2021-09-14 14:59:09 +02:00
}
2021-03-30 12:25:12 +02:00
{
name = "Kratylos";
url = "https://kratylos.reichert-online.org/current_issue/KRATYLOS";
filter = [ { element-by-id = "content"; } "html2text" "strip" ];
}
{
name = "Indogermanische Forschungen";
url = "https://www.degruyter.com/journal/key/INDO/html";
filter = [ { element-by-id = "latestIssue"; } "html2text" "strip" ];
}
{
name = "IG Neuigkeiten";
url = "https://www.indogermanistik.org/aktuelles/neuigkeiten.html";
filter = [ { css = "[itemprop=articleBody]"; } "html2text" "strip" ];
}
{
name = "IG Tagungen";
url = "https://www.indogermanistik.org/tagungen/tagungen-der-ig.html";
filter = [ { css = "[itemprop=articleBody]"; } "html2text" "strip" ];
}
{
name = "Christian-Metz-Blamage";
url = "https://www.deutschlandfunk.de/meine-nacht-schlaeft-nicht-pflanze-mich-nicht-in-dein-herz.700.de.html?dram:article_id=486475";
2021-03-30 12:25:12 +02:00
filter = [ { element-by-class = "dlf-articledetail"; } "html2text" "strip" ];
2020-11-17 14:06:13 +01:00
}
2021-02-15 21:46:49 +01:00
{
name = "fxght.or.flxght";
url = "https://api.tellonym.me/profiles/name/fxght.or.flxght?limit=20";
headers.tellonym-client = "web:0.52.0";
filter = [
{
shellpipe = ''
${pkgs.jq}/bin/jq '.answers | map({
question: .tell,
answer: .answer,
date: .createdAt,
media: .media | map(.url)
})'
'';
}
];
}
2020-11-05 21:29:20 +01:00
];
2021-04-07 09:37:57 +02:00
configFile = (pkgs.formats.yaml {}).generate "urlwatch.yaml" {
2020-11-05 21:29:20 +01:00
display = {
error = true;
new = true;
unchanged = false;
};
report = {
email = {
enabled = true;
from = "2210@cock.li";
html = false;
method = "smtp";
smtp = {
host = "mail.cock.li";
port = 587;
starttls = true;
auth = true;
insecure_password = lib.strings.fileContents <secrets/mail/cock>;
};
subject = "{count} changes: {jobs}";
to = kieran.email;
};
2021-08-02 08:44:33 +02:00
telegram = {
enabled = true;
bot_token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chat_id = "-1001504043752";
};
2020-11-05 21:29:20 +01:00
html.diff = "unified";
stdout = {
color = true;
enabled = true;
};
2020-11-17 14:06:13 +01:00
text.footer = false;
# telegram = {
# enabled = false;
# bot_token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
# chat_id = [ "18980945" ];
# };
2020-11-05 21:29:20 +01:00
};
2021-04-07 09:37:57 +02:00
};
2021-02-15 21:46:49 +01:00
urlwatch = pkgs.urlwatch.overrideAttrs (attrs: {
patches = [ <niveum/packages/urlwatch-insecure.patch> ];
});
2020-11-05 21:29:20 +01:00
in
{
2020-11-05 21:29:20 +01:00
users.extraUsers.urlwatch = {
home = urlwatchDir;
createHome = true;
2021-06-01 19:14:00 +02:00
isSystemUser = true;
2021-12-01 12:03:33 +01:00
group = "urlwatch";
2020-11-05 21:29:20 +01:00
};
2021-12-01 12:03:33 +01:00
users.groups.urlwatch = {};
2020-11-05 21:29:20 +01:00
systemd.services.urlwatch = {
enable = true;
2020-11-05 21:29:20 +01:00
startAt = "*-*-* 05:00:00";
script = ''
2021-02-15 21:46:49 +01:00
${urlwatch}/bin/urlwatch \
2020-11-05 21:29:20 +01:00
--config=${lib.escapeShellArg configFile} \
--urls=${lib.escapeShellArg urlsFile}
'';
serviceConfig = {
User = config.users.extraUsers.urlwatch.name;
2021-12-01 12:03:33 +01:00
Group = config.users.groups.urlwatch.name;
2020-11-05 21:29:20 +01:00
WorkingDirectory = config.users.extraUsers.urlwatch.home;
PermissionsStartOnly = "true";
PrivateTmp = "true";
SyslogIdentifier = "urlwatch";
Type = "oneshot";
};
};
}