48 lines
1.6 KiB
Nix
48 lines
1.6 KiB
Nix
|
|
final: prev: {
|
||
|
|
panoptikon =
|
||
|
|
let
|
||
|
|
lib = prev.lib;
|
||
|
|
in
|
||
|
|
lib.recursiveUpdate prev.panoptikon {
|
||
|
|
url =
|
||
|
|
address:
|
||
|
|
prev.writers.writeDash "watch-url" ''
|
||
|
|
${prev.curl}/bin/curl -sSL ${lib.escapeShellArg address} \
|
||
|
|
| ${prev.python3Packages.html2text}/bin/html2text --decode-errors=ignore
|
||
|
|
'';
|
||
|
|
urlSelector =
|
||
|
|
selector: address:
|
||
|
|
prev.writers.writeDash "watch-url-selector" ''
|
||
|
|
${prev.curl}/bin/curl -sSL ${lib.escapeShellArg address} \
|
||
|
|
| ${prev.htmlq}/bin/htmlq ${lib.escapeShellArg selector} \
|
||
|
|
| ${prev.python3Packages.html2text}/bin/html2text
|
||
|
|
'';
|
||
|
|
urlJSON =
|
||
|
|
{
|
||
|
|
jqScript ? ".",
|
||
|
|
}:
|
||
|
|
address:
|
||
|
|
prev.writers.writeDash "watch-url-json" ''
|
||
|
|
${prev.curl}/bin/curl -sSL ${lib.escapeShellArg address} | ${prev.jq}/bin/jq -f ${prev.writeText "script.jq" jqScript}
|
||
|
|
'';
|
||
|
|
|
||
|
|
# reporter scripts
|
||
|
|
kpaste-irc =
|
||
|
|
{
|
||
|
|
target,
|
||
|
|
retiolumLink ? false,
|
||
|
|
server ? "irc.r",
|
||
|
|
messagePrefix ? "change detected: ",
|
||
|
|
nick ? ''"$PANOPTIKON_WATCHER"-watcher'',
|
||
|
|
}:
|
||
|
|
prev.writers.writeDash "kpaste-irc-reporter" ''
|
||
|
|
KPASTE_CONTENT_TYPE=text/plain ${prev.kpaste}/bin/kpaste \
|
||
|
|
| ${prev.gnused}/bin/sed -n "${if retiolumLink then "2" else "3"}s/^/${messagePrefix}/p" \
|
||
|
|
| ${prev.nur.repos.mic92.ircsink}/bin/ircsink \
|
||
|
|
--nick ${nick} \
|
||
|
|
--server ${server} \
|
||
|
|
--target ${target}
|
||
|
|
'';
|
||
|
|
};
|
||
|
|
}
|