From a67143a6ce08a48f11f87bb12be3695385a0242b Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 28 Apr 2023 15:28:48 +0200 Subject: [PATCH 01/12] nixpkgs-unstable: 645bc49 -> d6b863f --- krebs/nixpkgs-unstable.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index bd1ab98c0..11ac1c6e4 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "645bc49f34fa8eff95479f0345ff57e55b53437e", - "date": "2023-04-19T18:04:47+02:00", - "path": "/nix/store/jh86824939585dinrs1zlkh6cvz8l8l7-nixpkgs", - "sha256": "0kfndc7xdkm89yl0f27wdnwd6gdad3i49jx7gvaib1hz0ifpmxzv", + "rev": "d6b863fd9b7bb962e6f9fdf292419a775e772891", + "date": "2023-04-26T18:35:28+02:00", + "path": "/nix/store/kyr8hz9d55f9fffr4y8d3hz3zb7h9fhb-nixpkgs", + "sha256": "02rd1n6d453rdp2978bvnp99nyfa26jxgbsg78yb9mmdxvha3hnr", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, From b7c249b620f6431e673732f43904ab7d8126c6bf Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 28 Apr 2023 15:29:09 +0200 Subject: [PATCH 02/12] nixpkgs: fd901ef -> 15b7580 --- krebs/nixpkgs.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 7e478e9cf..bc350d0d7 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "fd901ef4bf93499374c5af385b2943f5801c0833", - "date": "2023-04-22T11:27:49+08:00", - "path": "/nix/store/gpfv5hbki6g1b63nqw7md5bjlcpzsz1w-nixpkgs", - "sha256": "1fd7xyfna0klfbv37qq1ms2j4gzjpy14a8vbnw1i8ix6fijkywjf", + "rev": "15b75800dce80225b44f067c9012b09de37dfad2", + "date": "2023-04-26T21:45:16+02:00", + "path": "/nix/store/5d3a0nazp51ndfgf9dpgyyw14g5i02mh-nixpkgs", + "sha256": "0xmza136qf0hssh2a4dq62w7w1xs6rdfxs314pqxqjvvqibf1qb2", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, From b91011c9ec595bde7de1b9766cfff3edf03fcdce Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 28 Apr 2023 17:40:14 +0200 Subject: [PATCH 03/12] l aergia.r: disable vbox --- lass/1systems/aergia/config.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lass/1systems/aergia/config.nix b/lass/1systems/aergia/config.nix index 6992db4a5..d49040a7a 100644 --- a/lass/1systems/aergia/config.nix +++ b/lass/1systems/aergia/config.nix @@ -65,8 +65,4 @@ ]; boot.cleanTmpDir = true; - - # vbox - virtualisation.virtualbox.host.enable = true; - users.users.mainUser.extraGroups = [ "vboxusers" ]; } From 67a2ab17a6b06527a31b03770615d5f64c18cded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 27 Apr 2023 18:08:16 +0200 Subject: [PATCH 04/12] kartei/mic92/blob64: add ip addressses --- kartei/mic92/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kartei/mic92/default.nix b/kartei/mic92/default.nix index 952b5fd40..003c66c66 100644 --- a/kartei/mic92/default.nix +++ b/kartei/mic92/default.nix @@ -809,7 +809,14 @@ in { blob64 = { owner = config.krebs.users.mic92; nets = rec { + internet = { + # of2.dse.cit.tum.de. + ip4.addr = "131.159.38.25"; + ip6.addr = "2a09:80c0:38::25"; + aliases = [ "blob64.i" ]; + }; retiolum = { + via = internet; aliases = [ "blob64.r" ]; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- From d3b150416989aae2fa4aebf097dac96d53cd2164 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 28 Apr 2023 23:11:21 +0200 Subject: [PATCH 05/12] vendor htgen-paste --- krebs/5pkgs/simple/htgen-paste/default.nix | 27 ++++++++ .../5pkgs/simple/htgen-paste/src/htgen-paste | 63 +++++++++++++++++++ lass/2configs/paste.nix | 11 +--- 3 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 krebs/5pkgs/simple/htgen-paste/default.nix create mode 100644 krebs/5pkgs/simple/htgen-paste/src/htgen-paste diff --git a/krebs/5pkgs/simple/htgen-paste/default.nix b/krebs/5pkgs/simple/htgen-paste/default.nix new file mode 100644 index 000000000..48b72833e --- /dev/null +++ b/krebs/5pkgs/simple/htgen-paste/default.nix @@ -0,0 +1,27 @@ +{ pkgs, stockholm, stdenv }: +with stockholm.lib; + +stdenv.mkDerivation rec { + pname = "htgen-paste"; + version = "1.0.0"; + + src = ./src; + + buildPhase = '' + ( + exec > htgen-paste + echo PATH=${makeBinPath [ + pkgs.nix + pkgs.file + pkgs.coreutils + pkgs.findutils + ]} + echo STATEDIR=${shell.escape "\${STATEDIR-$HOME}"} + cat $src/htgen-paste + ) + ''; + + installPhase = '' + install -D htgen-paste $out/bin/htgen-paste + ''; +} diff --git a/krebs/5pkgs/simple/htgen-paste/src/htgen-paste b/krebs/5pkgs/simple/htgen-paste/src/htgen-paste new file mode 100644 index 000000000..bec238dca --- /dev/null +++ b/krebs/5pkgs/simple/htgen-paste/src/htgen-paste @@ -0,0 +1,63 @@ +find_item() { + if test ${#1} -ge 7; then + set -- "$(find "$STATEDIR/items" -mindepth 1 -maxdepth 1 \ + -regex "$STATEDIR/items/$1[0-9A-Za-z]*$")" + if test -n "$1" && test $(echo "$1" | wc -l) = 1; then + echo "$1" + return 0 + fi + fi + return 1 +} + +abs_path=${Request_URI%%\?*} + +case "$Method $abs_path" in + "GET /"[0-9a-z]*) + if item=$(find_item ${abs_path#/}); then + printf 'HTTP/1.1 200 OK\r\n' + printf 'Content-Type: %s\r\n' "$(file -ib $item)" + printf 'Server: %s\r\n' "$Server" + printf 'Connection: close\r\n' + printf 'Content-Length: %d\r\n' $(wc -c < $item) + printf '\r\n' + cat $item + exit + fi + ;; + "POST /") + content=$(mktemp -t htgen.$$.content.XXXXXXXX) + trap "rm $content >&2" EXIT + + case ${req_expect-} in 100-continue) + printf 'HTTP/1.1 100 Continue\r\n\r\n' + esac + + head -c $req_content_length > $content + + sha256=$(sha256sum -b $content | cut -d\ -f1) + base32=$(nix-hash --to-base32 --type sha256 $sha256) + item=$STATEDIR/items/$base32 + ref=http://$req_host/$base32 + + if ! test -e $item; then + mkdir -v -p $STATEDIR/items >&2 + cp -v $content $item >&2 + fi + + base32short=$(echo $base32 | cut -b-7) + if item=$(find_item $base32short); then + ref=$(echo "$ref"; echo "http://$req_host/$base32short") + fi + + printf 'HTTP/1.1 200 OK\r\n' + printf 'Content-Type: text/plain; charset=UTF-8\r\n' + printf 'Server: %s\r\n' "$Server" + printf 'Connection: close\r\n' + printf 'Content-Length: %d\r\n' $(expr ${#ref} + 1) + printf '\r\n' + printf '%s\n' "$ref" + + exit + ;; +esac diff --git a/lass/2configs/paste.nix b/lass/2configs/paste.nix index cfd7f5576..87768a452 100644 --- a/lass/2configs/paste.nix +++ b/lass/2configs/paste.nix @@ -82,14 +82,9 @@ with import ; krebs.htgen.paste = { port = 9081; - script = toString [ - "PATH=${makeBinPath [ - pkgs.nix - pkgs.file - ]}:$PATH" - "STATEDIR=$HOME" - ". ${pkgs.htgen}/examples/paste" - ]; + script = /* sh */ '' + (. ${pkgs.htgen-paste}/bin/htgen-paste) + ''; }; systemd.services.paste-gc = { From 40345c34bf6ff873e89e12ec66927cc5ec996d93 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 28 Apr 2023 23:49:03 +0200 Subject: [PATCH 06/12] htgen-paste: allow setting of Content-Type --- krebs/5pkgs/simple/htgen-paste/src/htgen-paste | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/krebs/5pkgs/simple/htgen-paste/src/htgen-paste b/krebs/5pkgs/simple/htgen-paste/src/htgen-paste index bec238dca..bc806e870 100644 --- a/krebs/5pkgs/simple/htgen-paste/src/htgen-paste +++ b/krebs/5pkgs/simple/htgen-paste/src/htgen-paste @@ -15,8 +15,9 @@ abs_path=${Request_URI%%\?*} case "$Method $abs_path" in "GET /"[0-9a-z]*) if item=$(find_item ${abs_path#/}); then + content_type=$(cat "$item".content_type 2>/dev/null || file -ib "$item") printf 'HTTP/1.1 200 OK\r\n' - printf 'Content-Type: %s\r\n' "$(file -ib $item)" + printf 'Content-Type: %s\r\n' "$content_type" printf 'Server: %s\r\n' "$Server" printf 'Connection: close\r\n' printf 'Content-Length: %d\r\n' $(wc -c < $item) @@ -45,6 +46,10 @@ case "$Method $abs_path" in cp -v $content $item >&2 fi + if test -n ${reg_content_type-}; then + echo -n "$req_content_type" > "$item".content_type + fi + base32short=$(echo $base32 | cut -b-7) if item=$(find_item $base32short); then ref=$(echo "$ref"; echo "http://$req_host/$base32short") From 194781fa5eb2fd5e9be3ac4fa57872659fec512b Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 3 May 2023 12:28:46 +0200 Subject: [PATCH 07/12] kpaste: allow override of Content-Type --- krebs/5pkgs/simple/kpaste/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/krebs/5pkgs/simple/kpaste/default.nix b/krebs/5pkgs/simple/kpaste/default.nix index 9820c931d..1c0225af7 100644 --- a/krebs/5pkgs/simple/kpaste/default.nix +++ b/krebs/5pkgs/simple/kpaste/default.nix @@ -1,6 +1,7 @@ { curl, gnused, writeDashBin }: writeDashBin "kpaste" '' - ${curl}/bin/curl -sS http://p.r --data-binary @"''${1:--}" | + ${curl}/bin/curl -sS http://p.r --data-binary @"''${1:--}" \ + -H "Content-Type-Override: ''${KPASTE_CONTENT_TYPE-}" ${gnused}/bin/sed '$ {p;s|http://p.r|https://p.krebsco.de|}' '' From a2b03cb28c97be3e9ccd382f7003f128508f1018 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 5 May 2023 01:32:18 +0200 Subject: [PATCH 08/12] kpaste: fix public url --- krebs/5pkgs/simple/kpaste/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krebs/5pkgs/simple/kpaste/default.nix b/krebs/5pkgs/simple/kpaste/default.nix index 1c0225af7..de2de4721 100644 --- a/krebs/5pkgs/simple/kpaste/default.nix +++ b/krebs/5pkgs/simple/kpaste/default.nix @@ -2,6 +2,6 @@ writeDashBin "kpaste" '' ${curl}/bin/curl -sS http://p.r --data-binary @"''${1:--}" \ - -H "Content-Type-Override: ''${KPASTE_CONTENT_TYPE-}" + -H "Content-Type-Override: ''${KPASTE_CONTENT_TYPE-}" | ${gnused}/bin/sed '$ {p;s|http://p.r|https://p.krebsco.de|}' '' From d39c0b2d18ea48a824b37d58746151b77451e0e8 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 5 May 2023 01:50:19 +0200 Subject: [PATCH 09/12] reaktor2: add bing-img --- krebs/2configs/reaktor2.nix | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 0a5031415..de1e01a35 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -90,6 +90,52 @@ let }; }; + bing-img = { + pattern = "!bing-img (.*)$"; + activate = "match"; + arguments = [1]; + timeoutSec = 1337; + command = { + filename = pkgs.writeDash "bing-img" '' + set -efu + report_error() { + printf '%s' "$*" | + curl -Ss http://p.r --data-binary @- | + tail -1 | + echo "error $(cat)" + exit 0 + } + export PATH=${makeBinPath [ + pkgs.dash + pkgs.coreutils + pkgs.curl + pkgs.findutils + pkgs.jq + ]} + response=$(printf '%s' "$*" | + curl -SsG http://bing-gpt.r/api/images --data-urlencode 'prompt@-' + ) + if [ "$?" -ne 0 ]; then + report_error "$response" + else + if ! text=$( + printf '%s' "$response" | + jq -er '.[].url' + ); then + echo "$_from: $(report_error "$response")" + exit 0 + fi + echo "$text" | + xargs -I {} dash -c 'curl -Ss {} | + curl -Ss https://p.krebsco.de --data-binary @- | + tail -1' | + tr '\n' ' ' | + echo "$_from: $(cat)" + fi + ''; + }; + }; + confuse = { pattern = "!confuse (.*)$"; activate = "match"; @@ -362,6 +408,7 @@ let bedger-add bedger-balance bing + bing-img hooks.sed interrogate say From 5c242487a88ecd1b0b84989782568534b65767fe Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 12 May 2023 09:58:26 +0200 Subject: [PATCH 10/12] nixpkgs: 15b7580 -> a08e061 --- krebs/nixpkgs.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index bc350d0d7..4ba72d00d 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "15b75800dce80225b44f067c9012b09de37dfad2", - "date": "2023-04-26T21:45:16+02:00", - "path": "/nix/store/5d3a0nazp51ndfgf9dpgyyw14g5i02mh-nixpkgs", - "sha256": "0xmza136qf0hssh2a4dq62w7w1xs6rdfxs314pqxqjvvqibf1qb2", + "rev": "a08e061a4ee8329747d54ddf1566d34c55c895eb", + "date": "2023-05-09T12:11:35+02:00", + "path": "/nix/store/lwy9r49c92ml9mbvp2kx1m31p7bcpzxd-nixpkgs", + "sha256": "1h0yd0xka6wj9sbbq34gw7a9qlp044b7dhg16bmn8bv96ix55vzj", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, From 6db3832db5e60838a925916ad095683d7272106f Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 12 May 2023 09:58:42 +0200 Subject: [PATCH 11/12] nixpkgs-unstable: d6b863f -> 897876e --- krebs/nixpkgs-unstable.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index 11ac1c6e4..d9e81ad37 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "d6b863fd9b7bb962e6f9fdf292419a775e772891", - "date": "2023-04-26T18:35:28+02:00", - "path": "/nix/store/kyr8hz9d55f9fffr4y8d3hz3zb7h9fhb-nixpkgs", - "sha256": "02rd1n6d453rdp2978bvnp99nyfa26jxgbsg78yb9mmdxvha3hnr", + "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7", + "date": "2023-05-06T22:28:42+01:00", + "path": "/nix/store/55lpvam2wgdmrbzx0j5gf51dqrqn8wqv-nixpkgs", + "sha256": "0i9j45jwmqhiv7v8i4dmigaras3iw4hmrds2vvd5x8riln3hyizn", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, From df09f8293f326235d417ec750edf05298ba468de Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 14 May 2023 19:56:47 +0200 Subject: [PATCH 12/12] reaktor2 bing: split lines after 426 chars --- krebs/2configs/reaktor2.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index de1e01a35..67c2dd4cd 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -81,7 +81,8 @@ let echo "$_from: $(report_error "$response")" exit 0 fi - printf '%s' "$text" | echo "$_from: $(cat)" + # value seems to be 512 - overhead + echo "$_from: $text" | fold -s -w 426 printf '%s' "$response" | jq -r '[.item.messages[1].sourceAttributions[].seeMoreUrl] | to_entries[] | "[\(.key + 1)]: \(.value)"'