This commit is contained in:
lassulus 2024-08-13 21:40:49 +02:00
parent 8b43b9c44d
commit b114638339
6 changed files with 0 additions and 302 deletions

View File

@ -102,34 +102,6 @@ in {
}; };
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICxFkBln23wUxt4RhIHE3GvdKeBpJbjn++6maupHqUHp"; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICxFkBln23wUxt4RhIHE3GvdKeBpJbjn++6maupHqUHp";
}; };
news = {
ci = true;
nets = {
retiolum = {
ip4.addr = "10.243.0.5";
aliases = [
"rss.r"
];
tinc.pubkey = ''
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9PY6t6P1ytgo8qYL2QDc
cgPezX8yGmA0nuTyCUPtXbWyWee9HnzYqekzJYvBHwgBDvZ8UhLZTCXD15agDfaf
cbzd4uM5bCDgqI8sezzD95tqj7mzvIEurIShDXYSWC6YRat1h1Opp86JngBJRvHZ
Gb6NAyfnr4v2eyMrmH9/j+sECxjCAaC5QLpJWyoDPilFU8dXBarmiZNYYlXQt1pn
yxZSF5pElmrdiZ6vlKlnEHwFtExm1gv63ZjAlusrXM+bKMvdVKRnhahq76A5VXjc
kbOhQi+wYGaVK4jB2a1UilmKYh1wKLE7HULoHDRrqEe4jemNZg+JOBPTU+jM/JzM
XdPy0KAMxHOUZCe8IX0LgF1snVaMF05Qkoe3QKr0YJ3KTD7UdsJpa1Br216Z/w2f
koz+cRn/Z/8TO8SIRKvy5TfXeH+ra6rp/CvwryNlNL4FB+25LFDkJtLIZGqAsz3G
vRXUiGN4l1FR4TbX7XaK2rvIlA/+4isJ02bBdnZhe7kmuuBeECyPaR1+Ui6pElXe
ZamnxTAmj86Q8pDx6Wn2cg8YAJlVV3UCfhda34DZokJmmmKucGupg/6Xt0Bhm9d5
exNrTIDG3lXTxmg2mfiZJeg/fsnalvtN0j/VB+NmmKzie+ZohMK4nUfslq8o5CO9
j7ZLmZzm062GzX0RenxNkwUCAwEAAQ==
-----END PUBLIC KEY-----
'';
};
};
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHl5cDF9QheXyMlNYIX17ILbgd94K50fZy7w0fDLvZlo ";
};
onebutton = { onebutton = {
nets = { nets = {
retiolum = { retiolum = {

View File

@ -1,25 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports = [
../../../krebs
../../../krebs/2configs
../../../krebs/2configs/ircd.nix
../../../krebs/2configs/go.nix
#### NEWS ####
../../../krebs/2configs/ircd.nix
../../../krebs/2configs/news.nix
];
krebs.build.host = config.krebs.hosts.news;
krebs.hosts.news.ssh.privkey.path = "${config.krebs.secret.directory}/ssh.id_ed25519";
boot.isContainer = true;
networking.useDHCP = lib.mkForce true;
krebs.sync-containers3.inContainer = {
enable = true;
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMBVZomw68WDQy0HsHhNbWK1KpzaR5aRUG1oioE7IgCv";
};
}

View File

@ -19,8 +19,6 @@
<stockholm/krebs/2configs/binary-cache/nixos.nix> <stockholm/krebs/2configs/binary-cache/nixos.nix>
<stockholm/krebs/2configs/binary-cache/prism.nix> <stockholm/krebs/2configs/binary-cache/prism.nix>
## news host
<stockholm/krebs/2configs/container-networking.nix> <stockholm/krebs/2configs/container-networking.nix>
<stockholm/krebs/2configs/syncthing.nix> <stockholm/krebs/2configs/syncthing.nix>

View File

@ -1,7 +0,0 @@
{ config,lib, ... }:
{
nixpkgs.config.allowUnfree = true; # "consul-1.18.0"
krebs.sync-containers3.containers.news = {
sshKey = "${config.krebs.secret.directory}/news.sync.key";
};
}

View File

@ -1,207 +0,0 @@
{ config, pkgs, ... }:
{
services.rss-bridge = {
enable = true;
whitelist = [ "*" ];
};
services.nginx.virtualHosts = {
rss-bridge = {
serverAliases = [
"rss.r"
];
};
"brockman.r" = {
serverAliases = [
"news.r"
];
locations."/api".extraConfig = ''
proxy_pass http://127.0.0.1:7777/;
proxy_pass_header Server;
'';
locations."= /graph.html".extraConfig = ''
alias ${pkgs.fetchurl {
url = "https://raw.githubusercontent.com/kmein/brockman/05d33c8caaaf6255752f9600981974bb58390851/tools/graph.html";
sha256 = "0iw2vdzj6kzkix1c447ybmc953lns6z4ap6sr9pcib8bany4g43w";
}};
'';
locations."/".extraConfig = ''
root /var/lib/brockman;
index brockman.json;
'';
extraConfig = ''
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
'';
};
};
systemd.tmpfiles.rules = [
"d /var/lib/brockman 1750 brockman nginx -"
"d /run/irc-api 1750 brockman nginx -"
];
systemd.services.brockman-graph = {
path = [
pkgs.graphviz
pkgs.jq
pkgs.inotify-tools
];
serviceConfig = {
ExecStart = pkgs.writers.writeDash "brockman-graph" ''
while :; do
graphviz="$(cat /var/lib/brockman/brockman.json \
| jq -r '
.bots |
to_entries |
map(select(.value.extraChannels|length > 1 )) |
.[] |
"\"\(.key)\" -> {\(.value.extraChannels|map("\""+.+"\"")|join(" "))}"
')"
echo "digraph news { $graphviz }" | circo -Tsvg > /var/lib/brockman/graph.svg
inotifywait -q -e MODIFY /var/lib/brockman/brockman.json
done
'';
User = "brockman";
};
wantedBy = [ "multi-user.target" ];
};
services.ergochat.openFilesLimit = 16384;
services.ergochat.settings = {
limits.nicklen = 100;
limits.identlen = 100;
history.enabled = false;
};
systemd.services.brockman.bindsTo = [ "ergochat.service" ];
systemd.services.brockman.serviceConfig.LimitNOFILE = 16384;
systemd.services.brockman.environment.BROCKMAN_LOG_LEVEL = "DEBUG";
krebs.brockman = {
enable = true;
config = {
irc.host = "localhost";
channel = "#all";
shortener = "http://go.r";
controller = {
nick = "brockman";
extraChannels = [ "#all" ];
};
statePath = "/var/state/brockman/brockman.json";
bots = {};
};
};
krebs.reaktor2.api = {
hostname = "localhost";
port = "6667";
nick = "api";
API.listen = "inet://127.0.0.1:7777";
plugins = [
{
plugin = "register";
config = {
channels = [
"#all"
];
};
}
];
};
krebs.reaktor2.news = let
name = "candyman";
in {
hostname = "localhost";
port = "6667";
nick = name;
plugins = [
{
plugin = "register";
config = {
channels = [
"#all"
"#aluhut"
"#news"
"#lasstube"
];
};
}
{
plugin = "system";
config = {
hooks.PRIVMSG = [
{
activate = "match";
pattern = "^${name}:\\s*(\\S*)(?:\\s+(.*\\S))?\\s*$";
command = 1;
arguments = [2];
commands = {
add-reddit.filename = pkgs.writeDash "add-reddit" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: add-reddit $reddit_channel'
exit 1
fi
reddit_channel=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
echo "brockman: add r_$reddit_channel http://rss.r/?action=display&bridge=Reddit&context=single&r=$reddit_channel&format=Atom"
'';
add-telegram.filename = pkgs.writeDash "add-telegram" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: add-telegram $telegram_user'
exit 1
fi
telegram_user=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
echo "brockman: add t_$telegram_user http://rss.r/?action=display&bridge=Telegram&username=$telegram_user&format=Mrss"
'';
add-youtube.filename = pkgs.writeDash "add-youtube" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: add-youtube $nick $channel/video/stream/id'
exit 1
fi
youtube_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
youtube_url=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][1]')
if [ ''${#youtube_url} -eq 24 ]; then
youtube_id=$youtube_url
else
youtube_id=$(${pkgs.yt-dlp}/bin/yt-dlp --max-downloads 1 -j "$youtube_url" | ${pkgs.jq}/bin/jq -r '.channel_id')
fi
echo "brockman: add yt_$youtube_nick http://rss.r/?action=display&bridge=Youtube&context=By+channel+id&c=$youtube_id&duration_min=&duration_max=&format=Mrss"
'';
add-twitch.filename = pkgs.writeDash "add-twitch" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: add-twitch $handle'
exit 1
fi
twitch_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
echo "brockman: add twitch_$twitch_nick http://rss.r/?action=display&bridge=Twitch&channel=$twitch_nick&type=all&format=Atom"
'';
add-twitter.filename = pkgs.writeDash "add-twitter" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: add-twitter $handle'
exit 1
fi
twitter_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
echo "brockman: add tw_$twitter_nick http://rss.r/?action=display&bridge=Twitter&context=By+username&u=$twitter_nick&norep=on&noretweet=on&nopinned=on&nopic=on&format=Atom"
'';
search.filename = pkgs.writeDash "search" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: search $searchterm'
exit 1
fi
searchterm=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$searchterm&info=true&favicon=false" |
${pkgs.jq}/bin/jq '.[].url'
'';
};
}
];
};
}
];
};
}

View File

@ -1,33 +0,0 @@
{ config, lib, pkgs, fetchFromGitHub, stdenv, ... }:
stdenv.mkDerivation rec {
pname = "rss-bridge";
version = "unstable-2021-12-02";
src = fetchFromGitHub {
owner = "RSS-Bridge";
repo = "rss-bridge";
rev = "f469489b569d22fb5edbd13c6e5f5abf2a4ee186";
sha256 = "sha256-LyxcycXbOFZR0mMDMUqAOjWrHIE2ftxkAYUGBbcQF5k==";
};
patchPhase = ''
substituteInPlace lib/rssbridge.php \
--replace "define('PATH_CACHE', PATH_ROOT . 'cache/');" "define('PATH_CACHE', getenv('RSSBRIDGE_DATA') . '/cache/');" \
--replace "define('FILE_CONFIG', PATH_ROOT . 'config.ini.php');" "define('FILE_CONFIG', getenv('RSSBRIDGE_DATA') . '/config.ini.php');" \
--replace "define('WHITELIST', PATH_ROOT . 'whitelist.txt');" "define('WHITELIST', getenv('RSSBRIDGE_DATA') . '/whitelist.txt');"
'';
installPhase = ''
mkdir $out/
cp -R ./* $out
'';
meta = with lib; {
description = "The RSS feed for websites missing it";
homepage = "https://github.com/RSS-Bridge/rss-bridge";
license = licenses.unlicense;
maintainers = with maintainers; [ dawidsowa ];
platforms = platforms.all;
};
}