Compare commits

...

10 commits

Author SHA1 Message Date
makefu 17c0846711
puyak.r: use relative import 2024-09-06 22:44:11 +02:00
lassulus 8fa5751b08 remove deprecated sound option 2024-08-20 20:44:15 +02:00
lassulus 0a87046e6c flake.lock: update 2024-08-20 20:28:06 +02:00
lassulus c833fb8c1b go: use sha hashes & redis sockets 2024-08-20 20:27:19 +02:00
lassulus fe1979c9d1 Merge remote-tracking branch 'mic92/master' 2024-08-13 21:42:06 +02:00
lassulus 2ab1816af0 kartei: add rss.r to ful.r 2024-08-13 21:41:34 +02:00
lassulus b114638339 RIP news 2024-08-13 21:40:49 +02:00
lassulus 8b43b9c44d kartei: move go.r to neoprism 2024-08-13 21:30:01 +02:00
Jörg Thalheim 09734b6f6a kartei mic92: add hosts 2024-08-13 19:00:02 +00:00
lassulus 736e922c87 reaktor2: add type to port 2024-08-13 20:10:21 +02:00
15 changed files with 165 additions and 364 deletions

View file

@ -9,11 +9,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1719326738,
"narHash": "sha256-9gEgR/teWxH1E3JUUunLrcgOpMel19nw//eK3XKU6RQ=",
"lastModified": 1724150417,
"narHash": "sha256-BF7UsEHmXvaVZc4m/pHEKxR122N34NgIpK0CPAXd01M=",
"owner": "Mic92",
"repo": "buildbot-nix",
"rev": "6e342155745f68b6d7ccc5557fa3d320b8aa3273",
"rev": "2d1bd50430303caf22bca06069e9f9bf3ff83f82",
"type": "github"
},
"original": {
@ -30,11 +30,11 @@
]
},
"locked": {
"lastModified": 1717285511,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
@ -61,11 +61,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1719254875,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
"lastModified": 1723991338,
"narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
"rev": "8a3354191c0d7144db9756a74755672387b702ba",
"type": "github"
},
"original": {
@ -90,11 +90,11 @@
]
},
"locked": {
"lastModified": 1718522839,
"narHash": "sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls=",
"lastModified": 1723808491,
"narHash": "sha256-rhis3qNuGmJmYC/okT7Dkc4M8CeUuRCSvW6kC2f3hBc=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "68eb1dc333ce82d0ab0c0357363ea17c31ea1f81",
"rev": "1d07739554fdc4f8481068f1b11d6ab4c1a4167a",
"type": "github"
},
"original": {

View file

@ -38,6 +38,7 @@ in
"brockman.r"
"ful.r"
"news.r"
"rss.r"
];
ip4.addr = "10.243.2.107";
tinc.pubkey = ''

View file

@ -102,35 +102,6 @@ in {
};
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICxFkBln23wUxt4RhIHE3GvdKeBpJbjn++6maupHqUHp";
};
news = {
ci = true;
nets = {
retiolum = {
ip4.addr = "10.243.0.5";
aliases = [
"go.r"
"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 = {
nets = {
retiolum = {

View file

@ -21,6 +21,7 @@
aliases = [
"neoprism.r"
"cache.neoprism.r"
"go.r"
];
tinc.pubkey = ''
-----BEGIN RSA PUBLIC KEY-----

View file

@ -991,6 +991,106 @@ in {
};
};
};
tegan = {
owner = config.krebs.users.mic92;
nets = rec {
internet = {
# tegan.dos.cit.tum.de
ip4.addr = "131.159.38.2";
ip6.addr = "2a09:80c0:38::2";
aliases = [ "tegan.i" ];
};
retiolum = {
via = internet;
aliases = [ "tegan.r" ];
tinc.pubkey = ''
-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEA0Rg6R8RZkQ8lYMegQDOy8OB6y31jfcVufBHx/QWFzzX/aaoyJDNo
QPVwn7qWnArqXvvwMYT6boPLJPmEFfxt9mwHX3lTEQKj82FT86hjG5axujIx1EAa
5v1A5UbZiBwntQPhHP+ULaQLPhwRfU+NftCpf3NC1frP0xd4U0fzdmO86jVp9Mwr
T07IvJzaSg1tIodT8F4CYktRCC9u8uQmtOrU/8FoPcWHMFxYMLR+qB3KQ3WF4EPU
qw3vtADATjDpagFr5+E12dc//04iTJc9sQ254WcLH9kfb+i+AFJ9G8H24iM9Iyal
YuEAYPV1XOQ8SZ9PNrKcSJxvMebzOkhvmQIDAQAB
-----END RSA PUBLIC KEY-----
'';
tinc.pubkey_ed25519 = "7AlLnzY96NqA9I0og/RaY+HekMSUGlxoDFNy5VRzE+L";
};
};
};
xavier = {
owner = config.krebs.users.mic92;
nets = rec {
internet = {
# xavier.dos.cit.tum.de
ip4.addr = "131.159.102.27";
ip6.addr = "2a09:80c0:102::27";
aliases = [ "xavier.i" ];
};
retiolum = {
via = internet;
aliases = [ "xavier.r" ];
tinc.pubkey = ''
-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEA4mAnaYD/tImIFmpDVK819M8XqY5j6i85E1FuBfqkx4FFRY4qHlpT
1ykybkPPI64y0B2Nr698vg52LQB9jclbo8sm5q8X/kkgwOM7jS9uwO2k8XnUqi3l
bV22v5xTXjqPklP71Bc5dlvjVUfX5KwkEpzrSQ+NqIPrlzs9/nIeQONVdhrEsRBk
kMaSGHzRcBBP+rbsi+GqIN4VKUKlUmP3XiDGj9yGUnTSDbMf0CoOksmle9i6s2rV
J5Kp78LhIZ5el7Gd+wMtwWQYKcHbZJwpFt4ODlefKknLeDV0uJgJpUmF0r32Hlj0
OAkmtpaRdweKj/Va31jNvhgJidDe/qgrFwIDAQAB
-----END RSA PUBLIC KEY-----
'';
tinc.pubkey_ed25519 = "CkupwxlJG2SH5FkqxathLC4PSZCsrDMpOTOtvCqid3A";
};
};
};
#vicky = {
# owner = config.krebs.users.mic92;
# nets = rec {
# internet = {
# ip4.addr = "";
# ip6.addr = "";
# aliases = [ "vicky.i" ];
# };
# retiolum = {
# via = internet;
# aliases = [ "vicky.r" ];
# tinc.pubkey = ''
# '';
# tinc.pubkey_ed25519 = "";
# };
# };
#};
irene = {
owner = config.krebs.users.mic92;
nets = rec {
internet = {
# irene.dos.cit.tum.de
ip4.addr = "131.159.102.28";
ip6.addr = "2a09:80c0:102::28";
aliases = [ "irene.i" ];
};
retiolum = {
via = internet;
aliases = [ "irene.r" ];
tinc.pubkey = ''
-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEA2P7QtdfRmrI1gDBKQJv+kAJBeNz5/bDuJfCcLJ6fkOt3MduZvLDt
qCj2LBhdXBAEcIKzrvzgR9r9mfEU38hr6JgO01xBvyEHg9YSJJ/5iGu17ZdyeS96
3RRpUs2WtepA3vrhSH7xgncXXC3xoercdUGs2GK3qlx9VAcAR0hy5teQmkBGJecm
C2wXwwEajOL4HAAvv7gyEp6S5ow1DHSJXxe32FQb18YnR2WHXh40RfWJnvs+zeaV
QYN4v6XNJKGC3hux1QyGQbfABUeEnNzl9bDmVICpcNPAy09VWX10UCymmWX6612L
EYXB0lt3PhcsvRcXNlV8ZZrukY8EU+UY1wIDAQAB
-----END RSA PUBLIC KEY-----
'';
tinc.pubkey_ed25519 = "CAyCg6zgO14v5oI4sV9dpwmjS7jy9Ttb4SiuKI5OQyN";
};
};
};
};
users = {
mic92 = {

View file

@ -28,7 +28,6 @@ in
];
krebs.build.host = config.krebs.hosts.filebitch;
sound.enable = false;
services.udev.extraRules = ''
SUBSYSTEM=="net", ATTR{address}=="60:a4:4c:3d:52:cf", NAME="et0"

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

@ -2,51 +2,52 @@
{
imports = [
./net.nix
<stockholm/krebs>
<stockholm/krebs/2configs>
<stockholm/krebs/2configs/secret-passwords.nix>
<stockholm/krebs/2configs/hw/x220.nix>
../../../krebs
../../../krebs/2configs
../../2configs/secret-passwords.nix
../../2configs/hw/x220.nix
# see documentation in included getty-for-esp.nix:
# brain hosts/puyak/root
<stockholm/krebs/2configs/hw/getty-for-esp.nix>
../../2configs/hw/getty-for-esp.nix
../../2configs/buildbot/worker.nix
## initrd unlocking
# (brain hosts/puyak/luks-ssd;echo) | ssh root@$(brain krebs-secrets/puyak/initrd/hostname) 'cat > /crypt-ramfs/passphrase'
<stockholm/krebs/2configs/tor/initrd.nix>
# (brain hosts/puyak/luks-ssd;echo) | ssh root@$(brain krebs-secrets/puyak/initrd/hostname) 'cat /crypt-ramfs/passphrase'
../../2configs/tor/initrd.nix
<stockholm/krebs/2configs/binary-cache/nixos.nix>
<stockholm/krebs/2configs/binary-cache/prism.nix>
../../2configs/binary-cache/nixos.nix
../../2configs/binary-cache/prism.nix
## news host
<stockholm/krebs/2configs/container-networking.nix>
<stockholm/krebs/2configs/syncthing.nix>
../../2configs/container-networking.nix
../../2configs/syncthing.nix
### shackspace ###
# handle the worlddomination map via coap
<stockholm/krebs/2configs/shack/worlddomination.nix>
<stockholm/krebs/2configs/shack/ssh-keys.nix>
../../2configs/shack/worlddomination.nix
../../2configs/shack/ssh-keys.nix
# drivedroid.shack for shackphone
<stockholm/krebs/2configs/shack/drivedroid.nix>
# <stockholm/krebs/2configs/shack/nix-cacher.nix>
../../2configs/shack/drivedroid.nix
# ../../2configs/shack/nix-cacher.nix
# Say if muell will be collected
<stockholm/krebs/2configs/shack/muell_caller.nix>
../../2configs/shack/muell_caller.nix
# provide muellshack api: muell.shack
<stockholm/krebs/2configs/shack/muellshack.nix>
../../2configs/shack/muellshack.nix
# send mail if muell was not handled
<stockholm/krebs/2configs/shack/muell_mail.nix>
../../2configs/shack/muell_mail.nix
# provide light control api
<stockholm/krebs/2configs/shack/node-light.nix> # light.shack lounge.light.shack power.light.shack openhab.shack lightapi.shack
../../2configs/shack/node-light.nix # light.shack lounge.light.shack power.light.shack openhab.shack lightapi.shack
# light.shack web-ui
<stockholm/krebs/2configs/shack/light.shack.nix> #light.shack
../../2configs/shack/light.shack.nix #light.shack
# fetch the u300 power stats
<stockholm/krebs/2configs/shack/power/u300-power.nix>
../../2configs/shack/power/u300-power.nix
{ # do not log to /var/spool/log
@ -66,56 +67,55 @@
}
# create samba share for anonymous usage with the laser and 3d printer pc
<stockholm/krebs/2configs/shack/share.nix>
../../2configs/shack/share.nix
# mobile.lounge.mpd.shack
<stockholm/krebs/2configs/shack/mobile.mpd.nix>
../../2configs/shack/mobile.mpd.nix
# hass.shack
<stockholm/krebs/2configs/shack/glados>
<stockholm/krebs/2configs/shack/esphome.nix>
../../2configs/shack/glados
../../2configs/shack/esphome.nix
# connect to git.shackspace.de as group runner for rz
<stockholm/krebs/2configs/shack/gitlab-runner.nix>
../../2configs/shack/gitlab-runner.nix
# Statistics collection and visualization
# <stockholm/krebs/2configs/shack/graphite.nix> # graphiteApi is broken and unused(hopefully)
# ../../2configs/shack/graphite.nix # graphiteApi is broken and unused(hopefully)
## Collect data from mqtt.shack and store in graphite database
<stockholm/krebs/2configs/shack/mqtt_sub.nix>
../../2configs/shack/mqtt_sub.nix
## Collect radioactive data and put into graphite
<stockholm/krebs/2configs/shack/radioactive.nix>
../../2configs/shack/radioactive.nix
## mqtt.shack
<stockholm/krebs/2configs/shack/mqtt.nix>
../../2configs/shack/mqtt.nix
## influx.shack
<stockholm/krebs/2configs/shack/influx.nix>
../../2configs/shack/influx.nix
## Collect local statistics via collectd and send to collectd
# <stockholm/krebs/2configs/stats/shack-client.nix>
# <stockholm/krebs/2configs/stats/shack-debugging.nix>
# ../../2configs/stats/shack-client.nix
# ../../2configs/stats/shack-debugging.nix
## netbox.shack: Netbox is disabled as nobody seems to be using it anyway
# <stockholm/krebs/2configs/shack/netbox.nix>
# ../../2configs/shack/netbox.nix
# grafana.shack
<stockholm/krebs/2configs/shack/grafana.nix>
../../2configs/shack/grafana.nix
# shackdns.shack
# replacement for leases.shack and shackles.shack
<stockholm/krebs/2configs/shack/shackDNS.nix>
../../2configs/shack/shackDNS.nix
# monitoring: prometheus.shack
<stockholm/krebs/2configs/shack/prometheus/node.nix>
<stockholm/krebs/2configs/shack/prometheus/server.nix>
<stockholm/krebs/2configs/shack/prometheus/blackbox.nix>
#<stockholm/krebs/2configs/shack/prometheus/unifi.nix>
../../2configs/shack/prometheus/node.nix
../../2configs/shack/prometheus/server.nix
../../2configs/shack/prometheus/blackbox.nix
#../../2configs/shack/prometheus/unifi.nix
# TODO: alertmanager 0.24+ supports telegram
# <stockholm/krebs/2configs/shack/prometheus/alertmanager-telegram.nix>
# ../../2configs/shack/prometheus/alertmanager-telegram.nix
];
krebs.build.host = config.krebs.hosts.puyak;
krebs.hosts.puyak.ssh.privkey.path = "${config.krebs.secret.directory}/ssh.id_ed25519";
sound.enable = false;
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;

View file

@ -73,7 +73,6 @@ in
'';
time.timeZone = "Europe/Berlin";
sound.enable = false;
# avahi
services.avahi = {

View file

@ -1,4 +1,4 @@
{ buildbot-nix, ... }:
{ config, buildbot-nix, ... }:
{
imports = [
buildbot-nix.nixosModules.buildbot-worker
@ -6,6 +6,8 @@
services.buildbot-nix.worker = {
enable = true;
name = config.krebs.build.host.name;
workerPasswordFile = "/var/src/secrets/nix-worker-file";
masterUrl = "tcp:host=gum:port=9989";
};
}

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

@ -21,6 +21,7 @@ let
imp = {
services.redis.servers.go.enable = true;
users.users.htgen-go.extraGroups = [ "redis-go" ];
krebs.htgen.go = {
port = cfg.port;
@ -29,7 +30,7 @@ let
case "$Method $Request_URI" in
"GET /"*)
if item=$(${pkgs.redis}/bin/redis-cli --raw get "''${Request_URI#/}"); then
if item=$(${pkgs.redis}/bin/redis-cli -s /run/redis-go/redis.sock --raw get "''${Request_URI#/}"); then
printf 'HTTP/1.1 302 Found\r\n'
printf 'Content-Type: text/plain\r\n'
printf 'Connection: closed\r\n'
@ -54,11 +55,10 @@ let
)
sha256=$(echo "$uri" | sha256sum -b | cut -d\ -f1)
base32=$(${pkgs.nixStable}/bin/nix-hash --to-base32 --type sha256 "$sha256")
base32short=$(echo "$base32" | cut -c48-52)
${pkgs.redis}/bin/redis-cli set "$base32short" "$uri" >/dev/null
short=$(echo "$sha256" | cut -c1-8)
${pkgs.redis}/bin/redis-cli -s /run/redis-go/redis.sock set "$short" "$uri" >/dev/null
ref="http://$req_host/$base32short"
ref="http://$req_host/$short"
printf 'HTTP/1.1 200 OK\r\n'
printf 'Content-Type: text/plain; charset=UTF-8\r\n'

View file

@ -18,7 +18,7 @@ with import ../../lib/pure.nix { inherit lib; }; {
};
port = mkOption {
default = "6667";
# TODO type = types.service-name
type = types.str;
};
plugins = mkOption {
default = [];

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;
};
}