diff options
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/2configs/syncthing.nix | 12 | ||||
-rw-r--r-- | krebs/5pkgs/simple/vicuna-chat/default.nix | 33 | ||||
-rw-r--r-- | krebs/nixpkgs-unstable.json | 8 | ||||
-rw-r--r-- | krebs/nixpkgs.json | 8 |
4 files changed, 49 insertions, 12 deletions
diff --git a/krebs/2configs/syncthing.nix b/krebs/2configs/syncthing.nix index dac1863d5..d6d42ca11 100644 --- a/krebs/2configs/syncthing.nix +++ b/krebs/2configs/syncthing.nix @@ -1,17 +1,21 @@ -{ config, pkgs, ... }: with import <stockholm/lib>; let +{ options, config, pkgs, ... }: with import <stockholm/lib>; let mk_peers = mapAttrs (n: v: { id = v.syncthing.id; }); all_peers = filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts; - used_peer_names = unique (flatten (mapAttrsToList (n: v: v.devices) config.services.syncthing.declarative.folders)); + used_peer_names = unique (filter isString (flatten (mapAttrsToList (n: v: v.devices) config.services.syncthing.folders))); used_peers = filterAttrs (n: v: elem n used_peer_names) all_peers; in { services.syncthing = { enable = true; configDir = "/var/lib/syncthing"; - devices = mk_peers used_peers; key = toString <secrets/syncthing.key>; cert = toString <secrets/syncthing.cert>; - }; + # workaround for infinite recursion on unstable, remove in 23.11 + } // (if builtins.hasAttr "settings" options.services.syncthing then + { settings.devices = mk_peers used_peers; } + else + { devices = mk_peers used_peers; } + ); boot.kernel.sysctl."fs.inotify.max_user_watches" = 524288; } diff --git a/krebs/5pkgs/simple/vicuna-chat/default.nix b/krebs/5pkgs/simple/vicuna-chat/default.nix new file mode 100644 index 000000000..11a11aabe --- /dev/null +++ b/krebs/5pkgs/simple/vicuna-chat/default.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: +pkgs.writers.writeDashBin "vicuna-chat" '' + set -efu + + export PATH=${with pkgs; lib.makeBinPath [ + coreutils + curl + jq + ]} + + CONTEXT=''${CONTEXT:-$(date -Id)} + PROMPT=$* + + if ! test -e "$CONTEXT"; then + echo -n 'null' > "$CONTEXT" + fi + + add_to_context() { + jq -rc --argjson message "$1" '. + [$message]' "$CONTEXT" > "$CONTEXT.tmp" + mv "$CONTEXT.tmp" "$CONTEXT" + } + + add_to_context "{\"role\": \"user\", \"content\": \"$PROMPT\"}" + response=$( + jq -nc --slurpfile context "$CONTEXT" '{ + model: "vicuna-13b", + messages: $context[0], + }' | + curl -Ss http://vicuna.r/v1/chat/completions -H 'Content-Type: application/json' -d @- + ) + add_to_context "$(jq -rcn --argjson response "$response" '$response.choices[0].message')" + jq -rcn --argjson response "$response" '$response.choices[0].message.content' +'' diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index d9e81ad37..9b4622275 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7", - "date": "2023-05-06T22:28:42+01:00", - "path": "/nix/store/55lpvam2wgdmrbzx0j5gf51dqrqn8wqv-nixpkgs", - "sha256": "0i9j45jwmqhiv7v8i4dmigaras3iw4hmrds2vvd5x8riln3hyizn", + "rev": "7084250df3d7f9735087d3234407f3c1fc2400e3", + "date": "2023-05-22T13:19:02+02:00", + "path": "/nix/store/zgv3fzg2lywfqdrv4mghd62s9i6zxhrw-nixpkgs", + "sha256": "0nkg8h5ix0sbjqb0gdj5124nbg2gd1nmyl1p14cvlg77fs7afld6", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 4ba72d00d..d4d9cc743 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "a08e061a4ee8329747d54ddf1566d34c55c895eb", - "date": "2023-05-09T12:11:35+02:00", - "path": "/nix/store/lwy9r49c92ml9mbvp2kx1m31p7bcpzxd-nixpkgs", - "sha256": "1h0yd0xka6wj9sbbq34gw7a9qlp044b7dhg16bmn8bv96ix55vzj", + "rev": "a17f99dfcb9643200b3884ca195c69ae41d7f059", + "date": "2023-05-23T18:09:00+02:00", + "path": "/nix/store/2n82i65gv1y54xj3dplkvhfyc8rs1j90-nixpkgs", + "sha256": "180ipicp351s99nvn9xvf5nzs5fzxhawfbykaijvaqj63siss13m", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, |