From e6ef361bb9b984ccee138c290244e925f97e2907 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 11 Apr 2023 22:35:48 +0200 Subject: hotdog.r: repo-sync stockholm, define krops --- krebs/2configs/repo-sync.nix | 110 +++++++++---------------------------------- 1 file changed, 22 insertions(+), 88 deletions(-) (limited to 'krebs/2configs') diff --git a/krebs/2configs/repo-sync.nix b/krebs/2configs/repo-sync.nix index e2be477f..9f129d81 100644 --- a/krebs/2configs/repo-sync.nix +++ b/krebs/2configs/repo-sync.nix @@ -22,7 +22,6 @@ let post-receive = pkgs.git-hooks.irc-announce { channel = "#xxx"; refs = [ - "refs/heads/master" "refs/heads/newest" "refs/tags/*" ]; @@ -37,7 +36,6 @@ let { user = with config.krebs.users; [ config.krebs.users."${config.networking.hostName}-repo-sync" - jeschli lass makefu tv @@ -50,7 +48,7 @@ let konsens-user ]; repo = [ repo ]; - perm = push ''refs/heads/master'' [ create merge ]; + perm = push "refs/heads/common" [ create merge ]; } { user = attrValues config.krebs.users; @@ -61,31 +59,18 @@ let repos."${name}" = repo; }; - sync-retiolum = { + sync-repo = { name, + remotes, desc ? "mirror for ${name}", section ? "mirror" }: { krebs.repo-sync.repos.${name} = { - branches = { - lassulus = { - origin.url = "http://cgit.lassul.us/${name}"; - mirror.url = "${mirror}${name}"; - }; - makefu = { - origin.url = "http://cgit.gum/${name}"; - mirror.url = "${mirror}${name}"; - }; - nin = { - origin.url = "http://cgit.onondaga.r/${name}"; - mirror.url = "${mirror}${name}"; - }; - tv = { - origin.url = "http://cgit.ni.r/${name}"; - mirror.url = "${mirror}${name}"; - }; - }; + branches = (lib.mapAttrs' (user: url: lib.nameValuePair user { + origin.url = url; + mirror.url = "${mirror}${name}"; + }) remotes); latest = { url = "${mirror}${name}"; ref = "heads/newest"; @@ -94,24 +79,6 @@ let krebs.git = defineRepo { inherit name desc section; }; }; - sync-remote = { - name, - url, - desc ? "mirror for ${name}", - section ? "mirror" - }: - { - krebs.repo-sync.repos.${name} = { - branches = { - remote = { - origin.url = url; - mirror.url = "${mirror}${name}"; - }; - }; - }; - krebs.git = defineRepo { inherit name desc section; }; - }; - in { krebs.git = { enable = true; @@ -126,7 +93,6 @@ in { krebs.konsens = { enable = true; repos = { - krops = { branchesToCheck = [ "lassulus" "tv" ]; }; stockholm = {}; }; }; @@ -137,52 +103,20 @@ in { }; imports = [ - (sync-retiolum { name = "the_playlist"; desc = "Good Music collection + tools"; section = "art"; }) - - (sync-retiolum { name = "stockholm"; desc = "take all computers hostage, they love it"; section = "configuration"; }) - - (sync-retiolum { name = "cholerab"; desc = "krebs thesauron & enterprise-patterns"; section = "documentation"; }) - - (sync-retiolum { name = "buildbot-classic"; desc = "fork of buildbot"; section = "software"; }) - (sync-retiolum { name = "disko"; desc = "take a description of your disk layout and produce a format script"; section = "software"; }) - (sync-retiolum { name = "news"; desc = "take a rss feed and a timeout and print it to stdout"; section = "software"; }) - (sync-retiolum { name = "krops"; desc = "krebs ops"; section = "software"; }) - (sync-retiolum { name = "go"; desc = "url shortener"; section = "software"; }) - (sync-retiolum { name = "much"; desc = "curses email client"; section = "software"; }) - (sync-retiolum { name = "newsbot-js"; desc = "irc rss/atom bot"; section = "software"; }) - (sync-retiolum { name = "nix-writers"; desc = "high level writers for nix"; section = "software"; }) - - (sync-retiolum { name = "cac-api"; desc = "CloudAtCost API command line interface"; section = "miscellaneous"; }) - (sync-retiolum { name = "dic"; desc = "dict.leo.org command line interface"; section = "miscellaneous"; }) - (sync-retiolum { name = "get"; section = "miscellaneous"; }) - (sync-retiolum { name = "hstool"; desc = "Haskell Development Environment ^_^"; section = "miscellaneous"; }) - (sync-retiolum { name = "htgen"; desc = "toy HTTP server"; section = "miscellaneous"; }) - (sync-retiolum { name = "kirk"; desc = "IRC tools"; section = "miscellaneous"; }) - (sync-retiolum { name = "load-env"; section = "miscellaneous"; }) - (sync-retiolum { name = "loldns"; desc = "toy DNS server"; section = "miscellaneous"; }) - (sync-retiolum { name = "netcup"; desc = "netcup command line interface"; section = "miscellaneous"; }) - (sync-retiolum { name = "populate"; desc = "source code installer"; section = "miscellaneous"; }) - (sync-retiolum { name = "q"; section = "miscellaneous"; }) - (sync-retiolum { name = "regfish"; section = "miscellaneous"; }) - (sync-retiolum { name = "soundcloud"; desc = "SoundCloud command line interface"; section = "miscellaneous"; }) - - (sync-retiolum { name = "blessings"; section = "Haskell libraries"; }) - (sync-retiolum { name = "mime"; section = "Haskell libraries"; }) - (sync-retiolum { name = "quipper"; section = "Haskell libraries"; }) - (sync-retiolum { name = "scanner"; section = "Haskell libraries"; }) - (sync-retiolum { name = "wai-middleware-time"; section = "Haskell libraries"; }) - (sync-retiolum { name = "web-routes-wai-custom"; section = "Haskell libraries"; }) - (sync-retiolum { name = "xintmap"; section = "Haskell libraries"; }) - (sync-retiolum { name = "xmonad-stockholm"; desc = "krebs xmonad modules"; section = "Haskell libraries"; }) - - (sync-remote { name = "array"; url = "https://github.com/makefu/array"; }) - (sync-remote { name = "email-header"; url = "https://github.com/4z3/email-header"; }) - (sync-remote { name = "mycube-flask"; url = "https://github.com/makefu/mycube-flask"; }) - (sync-remote { name = "reaktor-titlebot"; url = "https://github.com/makefu/reaktor-titlebot"; }) - (sync-remote { name = "repo-sync"; url = "https://github.com/makefu/repo-sync"; }) - (sync-remote { name = "skytraq-datalogger"; url = "https://github.com/makefu/skytraq-datalogger"; }) - (sync-remote { name = "realwallpaper"; url = "https://github.com/lassulus/realwallpaper"; }) - (sync-remote { name = "painload"; url = "https://github.com/krebs/painload"; }) - (sync-remote { name = "nixos-wiki"; url = "https://github.com/Mic92/nixos-wiki.wiki.git"; }) + (sync-repo { + name = "stockholm"; + desc = "take all computers hostage, they love it"; + section = "configuration"; + remotes = { + makefu = "http://cgit.gum.r/stockholm"; + tv = "http://cgit.ni.r/stockholm"; + lassulus = "http://cgit.orange.r/stockholm"; + }; + }) + ({ krebs.git = defineRepo { + name = "krops"; + desc = "deployment tools"; + section = "deployment"; + };}) ]; } -- cgit v1.2.3 From d8ca1ceb9d9f91b34312ca7f6645c97560907949 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 17 Apr 2023 14:30:48 +0200 Subject: reaktor2: add !bing command --- krebs/2configs/reaktor2.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'krebs/2configs') diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 39039cc1..03293201 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -51,6 +51,27 @@ let }; }; + bing = { + pattern = "!bing (.*)$"; + activate = "match"; + arguments = [1]; + timeoutSec = 42; + command = { + filename = pkgs.writeDash "bing" '' + set -efu + export PATH=${makeBinPath [ + pkgs.coreutils + pkgs.curl + pkgs.jq + ]} + printf '%s' "$*" | + curl -SsG http://bing-gpt.r/api/chat --data-urlencode 'prompt@-' | + jq -r '.item.messages[1].text' | + echo "$_from: $(cat)" + ''; + }; + }; + confuse = { pattern = "!confuse (.*)$"; activate = "match"; @@ -526,6 +547,7 @@ in { (systemPlugin { extra_privmsg_hooks = [ confuse + bing ]; }) ]; -- cgit v1.2.3 From 01c1fffe0ac51ad7a0ade29c4c4f6fed4394dd44 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 17 Apr 2023 15:59:58 +0200 Subject: reaktor2 bing: more timeout, footnotes --- krebs/2configs/reaktor2.nix | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'krebs/2configs') diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 03293201..8e2e5d9b 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -55,7 +55,7 @@ let pattern = "!bing (.*)$"; activate = "match"; arguments = [1]; - timeoutSec = 42; + timeoutSec = 1337; command = { filename = pkgs.writeDash "bing" '' set -efu @@ -64,10 +64,21 @@ let pkgs.curl pkgs.jq ]} - printf '%s' "$*" | - curl -SsG http://bing-gpt.r/api/chat --data-urlencode 'prompt@-' | - jq -r '.item.messages[1].text' | - echo "$_from: $(cat)" + response=$(printf '%s' "$*" | + curl -SsG http://bing-gpt.r/api/chat --data-urlencode 'prompt@-' + ) + if [ "$?" -ne 0 ]; then + printf '%s' "$response" | + curl -Ss http://p.r --data-binary @- | + tail -1 + else + printf '%s' "$response" | + jq -r '.item.messages[1].text' | + echo "$_from: $(cat)" + + printf '%s' "$response" | + jq -r '[.item.messages[1].sourceAttributions[].seeMoreUrl] | to_entries[] | "[\(.key)]: \(.value)"' + fi ''; }; }; -- cgit v1.2.3 From fef664e785cf7ae234abd540406fb894c784322b Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 17 Apr 2023 16:06:58 +0200 Subject: reaktor2 bing: start counting at 1 --- krebs/2configs/reaktor2.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/2configs') diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 8e2e5d9b..114c0871 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -77,7 +77,7 @@ let echo "$_from: $(cat)" printf '%s' "$response" | - jq -r '[.item.messages[1].sourceAttributions[].seeMoreUrl] | to_entries[] | "[\(.key)]: \(.value)"' + jq -r '[.item.messages[1].sourceAttributions[].seeMoreUrl] | to_entries[] | "[\(.key + 1)]: \(.value)"' fi ''; }; -- cgit v1.2.3 From 4ca30a227ba7728a0190b0d5ea0fa4d424142ee5 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 17 Apr 2023 16:07:14 +0200 Subject: reaktor2: use bing plugin on all bots --- krebs/2configs/reaktor2.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/2configs') diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 114c0871..502dd4a9 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -354,6 +354,7 @@ let } bedger-add bedger-balance + bing hooks.sed interrogate say @@ -558,7 +559,6 @@ in { (systemPlugin { extra_privmsg_hooks = [ confuse - bing ]; }) ]; -- cgit v1.2.3 From ac5e8cc3f4905d4e0e3beedb2ea67e749fccb80a Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 17 Apr 2023 16:43:31 +0200 Subject: reaktor2 bing: add error reporting --- krebs/2configs/reaktor2.nix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'krebs/2configs') diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 502dd4a9..0a503141 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -59,6 +59,13 @@ let command = { filename = pkgs.writeDash "bing" '' set -efu + report_error() { + printf '%s' "$*" | + curl -Ss http://p.r --data-binary @- | + tail -1 | + echo "error $(cat)" + exit 0 + } export PATH=${makeBinPath [ pkgs.coreutils pkgs.curl @@ -68,13 +75,13 @@ let curl -SsG http://bing-gpt.r/api/chat --data-urlencode 'prompt@-' ) if [ "$?" -ne 0 ]; then - printf '%s' "$response" | - curl -Ss http://p.r --data-binary @- | - tail -1 + report_error "$response" else - printf '%s' "$response" | - jq -r '.item.messages[1].text' | - echo "$_from: $(cat)" + if ! text=$(printf '%s' "$response" | jq -er '.item.messages[1].text'); then + echo "$_from: $(report_error "$response")" + exit 0 + fi + printf '%s' "$text" | echo "$_from: $(cat)" printf '%s' "$response" | jq -r '[.item.messages[1].sourceAttributions[].seeMoreUrl] | to_entries[] | "[\(.key + 1)]: \(.value)"' -- cgit v1.2.3 From 6ae9b8d8ed3440ffc634e468491b0da5d777379d Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 17 Apr 2023 17:24:31 +0200 Subject: ircd: more lines & hostnames --- krebs/2configs/ircd.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'krebs/2configs') diff --git a/krebs/2configs/ircd.nix b/krebs/2configs/ircd.nix index 5435ea16..c56883d3 100644 --- a/krebs/2configs/ircd.nix +++ b/krebs/2configs/ircd.nix @@ -38,6 +38,8 @@ hidden = false; password = "$2a$04$0AtVycWQJ07ymrDdKyAm2un3UVSVIzpzL3wsWbWb3PF95d1CZMcMO"; }; + server.max-line-length = 1024; + server.lookup-hostnames = true; }; }; } -- cgit v1.2.3