summaryrefslogtreecommitdiffstats
path: root/lass/2configs/fysiirc.nix
diff options
context:
space:
mode:
authorlassulus <git@lassul.us>2023-09-07 12:26:31 +0200
committerlassulus <git@lassul.us>2023-09-07 13:50:26 +0200
commitf55307fd73af235069744dd5155fda0bc73fe613 (patch)
treef048d7750a50e48493505a08784c96d07d291f89 /lass/2configs/fysiirc.nix
parent85ae348bf3f53125c8281669a32bf007dc0063be (diff)
lass: migrate away
Diffstat (limited to 'lass/2configs/fysiirc.nix')
-rw-r--r--lass/2configs/fysiirc.nix69
1 files changed, 0 insertions, 69 deletions
diff --git a/lass/2configs/fysiirc.nix b/lass/2configs/fysiirc.nix
deleted file mode 100644
index b2912d894..000000000
--- a/lass/2configs/fysiirc.nix
+++ /dev/null
@@ -1,69 +0,0 @@
-{ config, lib, pkgs, ... }: let
-
- format-github-message = pkgs.writeDashBin "format-github-message" ''
- set -efu
- export PATH=${lib.makeBinPath [
- pkgs.jq
- ]}
- INPUT=$(jq -c .)
- if $(printf '%s' "$INPUT" | jq 'has("issue") or has("pull_request")'); then
- ${write_to_irc} "$(printf '%s' "$INPUT" | jq -r '
- "\(.action): " +
- "[\(.issue.title // .pull_request.title)] " +
- "\(.comment.html_url // .issue.html_url // .pull_request.html_url) "
- ')"
- fi
- '';
-
- write_to_irc = pkgs.writeDash "write_to_irc" ''
- ${pkgs.curl}/bin/curl -fsSv http://localhost:44001 \
- -H content-type:application/json \
- -d "$(${pkgs.jq}/bin/jq -n \
- --arg text "$1" '{
- command:"PRIVMSG",
- params:["#fysi",$text]
- }'
- )"
- '';
-
-in {
- krebs.iptables.tables.filter.INPUT.rules = [
- { predicate = "-p tcp --dport 44002"; target = "ACCEPT"; }
- ];
- krebs.reaktor2.fysiweb-github = {
- hostname = "irc.libera.chat";
- port = "6697";
- useTLS = true;
- nick = "fysiweb-github";
- API.listen = "inet://127.0.0.1:44001";
- plugins = [
- {
- plugin = "register";
- config = {
- channels = [
- "#fysi"
- ];
- };
- }
- ];
- };
- krebs.htgen.fysiweb-github = {
- port = 44002;
- user = {
- name = "reaktor2-fysiweb-github";
- };
- script = ''. ${pkgs.writeDash "github-irc" ''
- set -xefu
- case "$Method $Request_URI" in
- "POST /")
- payload=$(head -c "$req_content_length")
- printf '%s' "$payload" | ${format-github-message}/bin/format-github-message
- printf 'HTTP/1.1 200 OK\r\n'
- printf 'Connection: close\r\n'
- printf '\r\n'
- exit
- ;;
- esac
- ''}'';
- };
-}