stockholm/krebs/2configs/news.nix

92 lines
2.2 KiB
Nix
Raw Normal View History

2021-01-21 16:58:27 +00:00
{ config, pkgs, ... }:
2017-09-03 22:16:54 +00:00
2017-09-08 22:16:50 +00:00
{
2021-01-08 11:20:29 +00:00
services.rss-bridge = {
enable = true;
whitelist = [ "*" ];
};
2021-01-12 21:21:32 +00:00
services.nginx.virtualHosts = {
rss-bridge = {
serverAliases = [
"rss.r"
];
};
"brockman.r" = {
2021-01-25 17:48:29 +00:00
serverAliases = [
"news.r"
];
2021-01-12 21:21:32 +00:00
locations."/".extraConfig = ''
root /var/lib/brockman;
index brockman.json;
'';
};
2021-01-08 11:20:29 +00:00
};
2021-01-12 21:21:32 +00:00
systemd.tmpfiles.rules = [
"d /var/lib/brockman 1750 brockman nginx -"
];
2021-01-08 11:20:29 +00:00
2020-12-30 10:46:12 +00:00
krebs.brockman = {
enable = true;
config = {
irc.host = "localhost";
2021-01-09 15:18:08 +00:00
channel = "#all";
2020-12-30 10:46:12 +00:00
shortener = "http://go.r";
2021-01-08 11:21:00 +00:00
controller = {
nick = "brockman";
channels = [ "#all" ];
2020-12-30 10:46:12 +00:00
};
2021-01-08 11:21:00 +00:00
bots = {};
2020-12-30 10:46:12 +00:00
};
2017-09-03 22:16:54 +00:00
};
2021-01-21 16:58:27 +00:00
krebs.reaktor2.news = {
hostname = "localhost";
port = "6667";
nick = "brockman-helper";
plugins = [
{
plugin = "register";
config = {
channels = [
"#all"
"#aluhut"
"#news"
];
};
}
{
plugin = "system";
config = {
hooks.PRIVMSG = [
{
activate = "match";
pattern = "^(?:.*\\s)?\\s*brockman-helper:\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$";
command = 1;
arguments = [2];
commands = {
add-telegram.filename = pkgs.writeDash "add-telegram" ''
if [ "$#" -ne 1 ]; then
echo 'usage: brockman-helper: add-telegram $telegramname'
echo "$#"
exit 1
fi
echo "brockman: add t_$1 http://rss.r/?action=display&bridge=Telegram&username=$1&format=Mrss"
'';
search.filename = pkgs.writeDash "search" ''
if [ "$#" -ne 1 ]; then
echo 'usage: brockman-helper: search $searchterm'
echo "$#"
exit 1
fi
2021-01-23 20:27:10 +00:00
${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$1&info=true&favicon=false" |
2021-01-21 16:58:27 +00:00
${pkgs.jq}/bin/jq '.[].url'
'';
};
}
];
};
}
];
};
2017-09-03 22:16:54 +00:00
}