added sibli support for buz
This commit is contained in:
1 parent
bfdcd45746
commit
3a2cb09d07
13 files changed
+236
No files matched your search
@@ -16,6 +16,7 @@ bin/
|
|||||||
├── remote.nu # `skyg remote *` (deploy, install, boot-all, status, reboot-pending)
|
├── remote.nu # `skyg remote *` (deploy, install, boot-all, status, reboot-pending)
|
||||||
├── secrets.nu # `skyg secrets [list]/show/edit/compare`
|
├── secrets.nu # `skyg secrets [list]/show/edit/compare`
|
||||||
├── ca.nu # `skyg ca init/issue`
|
├── ca.nu # `skyg ca init/issue`
|
||||||
|
├── buzz.nu # `skyg buzz identity`
|
||||||
├── pkgs.nu # `skyg pkgs update`
|
├── pkgs.nu # `skyg pkgs update`
|
||||||
├── flake.nu # `skyg flake update/check/check-versions`
|
├── flake.nu # `skyg flake update/check/check-versions`
|
||||||
├── build.nu # `skyg build image/openwrt`
|
├── build.nu # `skyg build image/openwrt`
|
||||||
@@ -54,6 +55,7 @@ bin/
|
|||||||
| `skyg secrets compare <secret>` | Diff the working copy against the stored secret |
|
| `skyg secrets compare <secret>` | Diff the working copy against the stored secret |
|
||||||
| `skyg ca init` | Generate the lab root CA: key → `secrets/lab-ca-key.age`, cert → `configs/pki/lab-ca.crt` (see `configs/pki/ABOUTME.md`) |
|
| `skyg ca init` | Generate the lab root CA: key → `secrets/lab-ca-key.age`, cert → `configs/pki/lab-ca.crt` (see `configs/pki/ABOUTME.md`) |
|
||||||
| `skyg ca issue <domain> --for <host>` | Mint a TLS leaf cert signed by the lab CA: cert → `configs/pki/<domain>.crt`, key → `secrets/<name>-tls-key.age`. Auto-registers missing `secrets.nix` entries. |
|
| `skyg ca issue <domain> --for <host>` | Mint a TLS leaf cert signed by the lab CA: cert → `configs/pki/<domain>.crt`, key → `secrets/<name>-tls-key.age`. Auto-registers missing `secrets.nix` entries. |
|
||||||
|
| `skyg buzz identity <robot>` | Make a Buzz (Nostr) identity for a robot's Hermes agent and merge `BUZZ_RELAY_URL` / `BUZZ_PRIVATE_KEY` (plus optional `--channels`, `--home-channel`). The bot answers anyone on the relay by default (`BUZZ_ALLOW_ALL_USERS=true`); `--allowed-users <npubs>` limits it to a list, `--restricted` allows no one into `secrets/robots-<robot>.age`, keeping its other lines. Refuses to replace an existing key without `--rotate`. `--dry-run` only shows the npub. Prints the `buzz-manage add-member <npub>` step. Needs `nak` (dev shell). |
|
||||||
| `skyg pkgs update [--all\|<pkg>]` | Update one or all custom packages |
|
| `skyg pkgs update [--all\|<pkg>]` | Update one or all custom packages |
|
||||||
| `skyg net check [device]` | For every managed device (or just `[device]`): report the NIC on the default route (model, driver, current link speed, supported speeds), then run `speedtest-go` via `nix-shell` against one shared server. Logs progress per device and returns a table. `--server <id>` picks the server; `--no-speedtest` skips the test. Offline devices are listed, not tested. Every run saves the table to `.tmp/net-checks/<timestamp>.nuon`; `--save <file>` also writes it to `<file>` (format from extension). The server is saved in `.tmp/net-checks/server.nuon` on first run; later runs ask whether to change it (fuzzy pick list from `speedtest-go --list`). `--server` skips the question and leaves the saved server alone. |
|
| `skyg net check [device]` | For every managed device (or just `[device]`): report the NIC on the default route (model, driver, current link speed, supported speeds), then run `speedtest-go` via `nix-shell` against one shared server. Logs progress per device and returns a table. `--server <id>` picks the server; `--no-speedtest` skips the test. Offline devices are listed, not tested. Every run saves the table to `.tmp/net-checks/<timestamp>.nuon`; `--save <file>` also writes it to `<file>` (format from extension). The server is saved in `.tmp/net-checks/server.nuon` on first run; later runs ask whether to change it (fuzzy pick list from `speedtest-go --list`). `--server` skips the question and leaves the saved server alone. |
|
||||||
| `skyg net last` | Show the table from the most recent `skyg net check` run (newest file in `.tmp/net-checks/`). |
|
| `skyg net last` | Show the table from the most recent `skyg net check` run (newest file in `.tmp/net-checks/`). |
|
||||||
|
|||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
use types.nu *
|
||||||
|
use helpers.nu *
|
||||||
|
|
||||||
|
# Same host as RELAY_URL in hosts/hl-minipc1/services/buzz.nix (public domain).
|
||||||
|
const BUZZ_DEFAULT_RELAY = "https://buzz.home.sosnovsky.ca"
|
||||||
|
|
||||||
|
# Robots that have a secrets/robots-<name>.age (robots-shared is not a robot).
|
||||||
|
def buzz-robots [] {
|
||||||
|
secret-names
|
||||||
|
| where {|s| ($s | str starts-with "robots-") and $s != "robots-shared" }
|
||||||
|
| each {|s| $s | str replace "robots-" "" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Drop existing KEY=... lines for the keys in `vars` and in `drop`, then append
|
||||||
|
# the new values. Every other line is kept as is.
|
||||||
|
def env-merge [lines: list<string>, vars: record, drop: list<string>] {
|
||||||
|
let keys = (($vars | columns) ++ $drop)
|
||||||
|
let kept = ($lines | where {|l|
|
||||||
|
let t = ($l | str trim)
|
||||||
|
not ($keys | any {|k| $t | str starts-with $"($k)=" })
|
||||||
|
})
|
||||||
|
$kept ++ ($vars | items {|k, v| $"($k)=($v)" })
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make a Buzz (Nostr) identity for a robot's Hermes agent and write the BUZZ_*
|
||||||
|
# env vars into secrets/robots-<robot>.age. Other lines in the secret are kept.
|
||||||
|
# By default the bot answers anyone on the relay (BUZZ_ALLOW_ALL_USERS=true).
|
||||||
|
# Pass --allowed-users for an explicit list, or --restricted for no one.
|
||||||
|
# The nsec is never printed. Afterwards, add the printed npub to the relay.
|
||||||
|
export def "skyg buzz identity" [
|
||||||
|
robot: string@buzz-robots # Robot name (secret: secrets/robots-<robot>.age)
|
||||||
|
--relay: string # BUZZ_RELAY_URL (default: the lab relay)
|
||||||
|
--allowed-users: string # Only these answer: comma-separated npubs or hex pubkeys (BUZZ_ALLOWED_USERS)
|
||||||
|
--restricted # Neither allow-all nor a list is set: the bot ignores everyone until you add one
|
||||||
|
--channels: string # BUZZ_CHANNELS: comma-separated channel UUIDs
|
||||||
|
--home-channel: string # BUZZ_HOME_CHANNEL: channel UUID for cron/notifications
|
||||||
|
--rotate # Replace an existing BUZZ_PRIVATE_KEY (loses relay membership)
|
||||||
|
--dry-run # Make a key and show the npub; do not touch the secret
|
||||||
|
] {
|
||||||
|
cd $REPO_ROOT
|
||||||
|
if (which nak | is-empty) {
|
||||||
|
error make {msg: "nak not found — run inside the dev shell (nix develop)"}
|
||||||
|
}
|
||||||
|
let secret = $"secrets/robots-($robot).age"
|
||||||
|
let relay_url = ($relay | default $BUZZ_DEFAULT_RELAY | str trim --right --char "/")
|
||||||
|
|
||||||
|
# Read the current secret first, so we fail before making anything.
|
||||||
|
mut existing = []
|
||||||
|
if not $dry_run {
|
||||||
|
if not ($secret | path exists) {
|
||||||
|
error make {msg: $"($secret) not found — create it first (skyg secrets edit robots-($robot))"}
|
||||||
|
}
|
||||||
|
$existing = (^agenix -d $secret | lines)
|
||||||
|
let has_key = ($existing | any {|l| ($l | str trim) | str starts-with "BUZZ_PRIVATE_KEY=" })
|
||||||
|
if $has_key and not $rotate {
|
||||||
|
error make {msg: $"($secret) already has BUZZ_PRIVATE_KEY. Use --rotate to replace it (the robot gets a new identity and must be re-added to the relay)."}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let hex = (^nak key generate | str trim)
|
||||||
|
let pubhex = (^nak key public $hex | str trim)
|
||||||
|
let nsec = (^nak encode nsec $hex | str trim)
|
||||||
|
let npub = (^nak encode npub $pubhex | str trim)
|
||||||
|
let ok = ($nsec | str starts-with "nsec1") and ($npub | str starts-with "npub1")
|
||||||
|
if not $ok {
|
||||||
|
error make {msg: "nak returned an unexpected key format; nothing was written"}
|
||||||
|
}
|
||||||
|
|
||||||
|
mut vars = {BUZZ_RELAY_URL: $relay_url, BUZZ_PRIVATE_KEY: $nsec}
|
||||||
|
if ($allowed_users | is-not-empty) { $vars = ($vars | insert BUZZ_ALLOWED_USERS $allowed_users) }
|
||||||
|
if ($channels | is-not-empty) { $vars = ($vars | insert BUZZ_CHANNELS $channels) }
|
||||||
|
if ($home_channel | is-not-empty) { $vars = ($vars | insert BUZZ_HOME_CHANNEL $home_channel) }
|
||||||
|
# Allow-all is the default; a list or --restricted turns it off (and clears a stale true).
|
||||||
|
mut drop = []
|
||||||
|
if ($allowed_users | is-not-empty) {
|
||||||
|
$vars = ($vars | insert BUZZ_ALLOWED_USERS $allowed_users)
|
||||||
|
$drop = ["BUZZ_ALLOW_ALL_USERS"]
|
||||||
|
} else if $restricted {
|
||||||
|
$drop = ["BUZZ_ALLOW_ALL_USERS"]
|
||||||
|
} else {
|
||||||
|
$vars = ($vars | insert BUZZ_ALLOW_ALL_USERS "true")
|
||||||
|
}
|
||||||
|
|
||||||
|
if $dry_run {
|
||||||
|
print $"Dry run: nothing written. Would set in ($secret):"
|
||||||
|
print ($vars | columns | each {|k| $" ($k)" } | str join "\n")
|
||||||
|
if ($drop | is-not-empty) { print $"Would remove: ($drop | str join ', ')" }
|
||||||
|
print $"npub: ($npub)"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Only --restricted can leave nobody allowed.
|
||||||
|
let gated = (
|
||||||
|
($allowed_users | is-not-empty)
|
||||||
|
or ($existing | any {|l| ($l | str trim) | str starts-with "BUZZ_ALLOWED_USERS=" })
|
||||||
|
)
|
||||||
|
|
||||||
|
# Straight into agenix over stdin: no plaintext file on disk.
|
||||||
|
let body = ((env-merge $existing $vars $drop) | str join "\n") + "\n"
|
||||||
|
$body | ^agenix -e $secret
|
||||||
|
|
||||||
|
print $"✅ Updated ($secret) with: ($vars | columns | str join ', ')"
|
||||||
|
print $"npub: ($npub)"
|
||||||
|
print "Next:"
|
||||||
|
print $" 1. On hl-minipc1: sudo buzz-manage add-member ($npub)"
|
||||||
|
print $" 2. Rebuild, then restart the robot: robotnix restart ($robot)"
|
||||||
|
if $restricted and not $gated {
|
||||||
|
print "⚠️ --restricted with no BUZZ_ALLOWED_USERS: the bot will ignore everyone. Re-run with --rotate --allowed-users <npub,...> or edit the secret."
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ export use remote.nu *
|
|||||||
export use os.nu *
|
export use os.nu *
|
||||||
export use secrets.nu *
|
export use secrets.nu *
|
||||||
export use ca.nu *
|
export use ca.nu *
|
||||||
|
export use buzz.nu *
|
||||||
export use pkgs.nu *
|
export use pkgs.nu *
|
||||||
export use flake.nu *
|
export use flake.nu *
|
||||||
export use build.nu *
|
export use build.nu *
|
||||||
|
|||||||
@@ -244,6 +244,7 @@
|
|||||||
agenix.packages.${system}.default
|
agenix.packages.${system}.default
|
||||||
age
|
age
|
||||||
yq
|
yq
|
||||||
|
nak
|
||||||
home-manager.packages.${system}.home-manager
|
home-manager.packages.${system}.home-manager
|
||||||
rustc
|
rustc
|
||||||
cargo
|
cargo
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
# sibli is ephemeral: root resets to this config on every start, so change
|
# sibli is ephemeral: root resets to this config on every start, so change
|
||||||
# things here (then rebuild the host), not inside the robot.
|
# things here (then rebuild the host), not inside the robot.
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
# The robot's own nixpkgs has no host overlay, so build it from the repo.
|
||||||
|
# Fine for the seed build; a rebuild inside the robot can't see this path.
|
||||||
|
buzz-cli = pkgs.callPackage ../../../../pkgs/buzz-cli { };
|
||||||
|
in
|
||||||
{
|
{
|
||||||
# The user has no password; ssh keys only.
|
# The user has no password; ssh keys only.
|
||||||
security.sudo.wheelNeedsPassword = false;
|
security.sudo.wheelNeedsPassword = false;
|
||||||
@@ -12,10 +17,26 @@
|
|||||||
htop
|
htop
|
||||||
claude-code
|
claude-code
|
||||||
devenv
|
devenv
|
||||||
|
direnv
|
||||||
|
(python3.withPackages (ps: [ ps.pip ]))
|
||||||
|
nodejs
|
||||||
|
docker-compose
|
||||||
zellij
|
zellij
|
||||||
|
buzz-cli
|
||||||
];
|
];
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
# direnv: hook into bash so the repo's devenv shims work.
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
interactiveShellInit = ''
|
||||||
|
eval "$(direnv hook bash)"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Hermes's Buzz platform runs `buzz`; the service PATH has no system packages.
|
||||||
|
services.hermes-agent.environment.BUZZ_CLI_PATH = "${buzz-cli}/bin/buzz";
|
||||||
|
|
||||||
# Docker + compose. Needs allowDocker = true on the host.
|
# Docker + compose. Needs allowDocker = true on the host.
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
users.users.ari.extraGroups = [ "docker" ];
|
users.users.ari.extraGroups = [ "docker" ];
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
niri-touchscreen-gestures = final.callPackage ../../pkgs/niri-touchscreen-gestures { };
|
niri-touchscreen-gestures = final.callPackage ../../pkgs/niri-touchscreen-gestures { };
|
||||||
# Buzz Desktop AppImage wrapper, see pkgs/buzz-desktop.
|
# Buzz Desktop AppImage wrapper, see pkgs/buzz-desktop.
|
||||||
buzz-desktop = final.callPackage ../../pkgs/buzz-desktop { };
|
buzz-desktop = final.callPackage ../../pkgs/buzz-desktop { };
|
||||||
|
# Buzz CLI (`buzz`), built from source, see pkgs/buzz-cli.
|
||||||
|
buzz-cli = final.callPackage ../../pkgs/buzz-cli { };
|
||||||
# Delta Editor (Zed Industries) prebuilt tarball, see pkgs/delta-editor.
|
# Delta Editor (Zed Industries) prebuilt tarball, see pkgs/delta-editor.
|
||||||
delta-editor = final.callPackage ../../pkgs/delta-editor { };
|
delta-editor = final.callPackage ../../pkgs/delta-editor { };
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ let
|
|||||||
colibri = final.callPackage ../pkgs/colibri { };
|
colibri = final.callPackage ../pkgs/colibri { };
|
||||||
niri-touchscreen-gestures = final.callPackage ../pkgs/niri-touchscreen-gestures { };
|
niri-touchscreen-gestures = final.callPackage ../pkgs/niri-touchscreen-gestures { };
|
||||||
buzz-desktop = final.callPackage ../pkgs/buzz-desktop { };
|
buzz-desktop = final.callPackage ../pkgs/buzz-desktop { };
|
||||||
|
buzz-cli = final.callPackage ../pkgs/buzz-cli { };
|
||||||
delta-editor = final.callPackage ../pkgs/delta-editor { };
|
delta-editor = final.callPackage ../pkgs/delta-editor { };
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -161,6 +161,26 @@ remote is private.
|
|||||||
`robotnix reseed` (flake.nix and robotnix.nix are written at install).
|
`robotnix reseed` (flake.nix and robotnix.nix are written at install).
|
||||||
Ephemeral robots pick changes up on the next host switch.
|
Ephemeral robots pick changes up on the next host switch.
|
||||||
|
|
||||||
|
### Buzz identity for a robot's Hermes
|
||||||
|
|
||||||
|
Each robot gets its own Buzz (Nostr) identity in its own `robots-<name>` secret:
|
||||||
|
|
||||||
|
1. `skyg buzz identity <robot>` makes a key and
|
||||||
|
merges `BUZZ_RELAY_URL` / `BUZZ_PRIVATE_KEY` (and the optional `BUZZ_*`
|
||||||
|
vars) into `secrets/robots-<robot>.age`. Other lines are kept. It needs the
|
||||||
|
secret to exist and refuses to replace a key without `--rotate`.
|
||||||
|
The bot answers anyone on the relay by default; `--allowed-users <npubs>`
|
||||||
|
limits it, `--restricted` allows no one.
|
||||||
|
2. Add the printed npub to the relay: `sudo buzz-manage add-member <npub>` on
|
||||||
|
hl-minipc1.
|
||||||
|
3. The robot needs `lanAccess` to the relay and the `buzz` CLI. The robot's
|
||||||
|
nixpkgs has no host overlay, so its config builds it with
|
||||||
|
`pkgs.callPackage <repo>/pkgs/buzz-cli { }` and points `BUZZ_CLI_PATH` at it
|
||||||
|
(`services.hermes-agent.environment`), because the service PATH has no
|
||||||
|
system packages. That relative path only resolves for the host's seed
|
||||||
|
build, not for a rebuild inside the robot. Restart the robot after the
|
||||||
|
secret changes.
|
||||||
|
|
||||||
## Docker and Tailscale (opt-in, host side only)
|
## Docker and Tailscale (opt-in, host side only)
|
||||||
|
|
||||||
These options only change what the host allows. Turn the service on in the
|
These options only change what the host allows. Turn the service on in the
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ Packages here are exposed via an overlay defined in `modules/core/default.nix`.
|
|||||||
| `colibri/` | colibrì (`JustVugg/colibri`) — GLM-5.2/OLMoE local inference engine, built from source, pinned to a tagged release. Backend-parameterized (`backend = "cpu" \| "rocm"`). Exposed as `pkgs.colibri` (cpu, default), `pkgs.colibri-rocm` (Strix Halo / gfx1151). Installs the `coli` CLI (wrapped with the Python env its converter/bench subcommands need) plus the bundled `colibri`/`olmoe` engine binaries. Model weights are a runtime concern and not packaged. |
|
| `colibri/` | colibrì (`JustVugg/colibri`) — GLM-5.2/OLMoE local inference engine, built from source, pinned to a tagged release. Backend-parameterized (`backend = "cpu" \| "rocm"`). Exposed as `pkgs.colibri` (cpu, default), `pkgs.colibri-rocm` (Strix Halo / gfx1151). Installs the `coli` CLI (wrapped with the Python env its converter/bench subcommands need) plus the bundled `colibri`/`olmoe` engine binaries. Model weights are a runtime concern and not packaged. |
|
||||||
| `niri-touchscreen-gestures/` | Python daemon that reads multi-touch events from a touchscreen via `evdev`, detects 2/3/4-finger swipes (up/down/left/right), and dispatches configurable `niri msg action` commands. Configured via TOML; exposed as `pkgs.niri-touchscreen-gestures`. |
|
| `niri-touchscreen-gestures/` | Python daemon that reads multi-touch events from a touchscreen via `evdev`, detects 2/3/4-finger swipes (up/down/left/right), and dispatches configurable `niri msg action` commands. Configured via TOML; exposed as `pkgs.niri-touchscreen-gestures`. |
|
||||||
| `buzz-desktop/` | Block Buzz desktop (Type-2 AppImage from `block/buzz`). Wrapped with `appimageTools.wrapType2` plus extra FHS libs (`elfutils`, `zstd`, WebKit/tray, GStreamer good/bad) so it runs on NixOS. Exposed as `pkgs.buzz-desktop` (`buzz-desktop` binary + desktop entry / icons). |
|
| `buzz-desktop/` | Block Buzz desktop (Type-2 AppImage from `block/buzz`). Wrapped with `appimageTools.wrapType2` plus extra FHS libs (`elfutils`, `zstd`, WebKit/tray, GStreamer good/bad) so it runs on NixOS. Exposed as `pkgs.buzz-desktop` (`buzz-desktop` binary + desktop entry / icons). |
|
||||||
|
| `buzz-cli/` | Buzz CLI (`buzz`, `crates/buzz-cli` of `block/buzz`), built with `rustPlatform.buildRustPackage` from the same tag as `buzz-desktop`. Hermes's Buzz platform shells out to it. Bump with `update.sh` (sets the source hash, resets `cargoHash` to `lib.fakeHash`; build once and paste the `got:` hash). Robots call it with `pkgs.callPackage` (their nixpkgs has no host overlay). |
|
||||||
| `delta-editor/` | Delta Editor (Zed Industries' AI-native editor, `delta.dev`) prebuilt tarball. No stable URL exists — the release API returns a short-lived signed R2 link — so `src` is a fixed-output derivation that resolves the API at build time. Interpreter/RPATH patched (`--force-rpath`, `dontPatchELF`), dlopen'd graphics libs (`libglvnd`, `vulkan-loader`, `wayland`) added via wrapper, `XKB_CONFIG_ROOT` set for the bundled libxkbcommon. Exposed as `pkgs.delta-editor` (`delta-editor` binary + desktop entry / icons); named `-editor` to avoid clashing with the `delta` git diff pager. |
|
| `delta-editor/` | Delta Editor (Zed Industries' AI-native editor, `delta.dev`) prebuilt tarball. No stable URL exists — the release API returns a short-lived signed R2 link — so `src` is a fixed-output derivation that resolves the API at build time. Interpreter/RPATH patched (`--force-rpath`, `dontPatchELF`), dlopen'd graphics libs (`libglvnd`, `vulkan-loader`, `wayland`) added via wrapper, `XKB_CONFIG_ROOT` set for the bundled libxkbcommon. Exposed as `pkgs.delta-editor` (`delta-editor` binary + desktop entry / icons); named `-editor` to avoid clashing with the `delta` git diff pager. |
|
||||||
|
|
||||||
## Adding a New Package
|
## Adding a New Package
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
{ lib
|
||||||
|
, rustPlatform
|
||||||
|
, fetchFromGitHub
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Buzz CLI (`buzz`, crates/buzz-cli in block/buzz). Hermes's Buzz platform
|
||||||
|
# runs it, so a robot with a Buzz identity needs it. Upstream ships no binary.
|
||||||
|
# Pinned to the same tag as pkgs/buzz-desktop. The relay image tracks `main`,
|
||||||
|
# so bump both together if the CLI and relay stop agreeing.
|
||||||
|
#
|
||||||
|
# To bump: run ./update.sh [<version>] (sets the source hash, resets
|
||||||
|
# cargoHash), then build once and paste the cargoHash from the "got:" line.
|
||||||
|
|
||||||
|
rustPlatform.buildRustPackage rec {
|
||||||
|
pname = "buzz-cli";
|
||||||
|
version = "0.5.28";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "block";
|
||||||
|
repo = "buzz";
|
||||||
|
rev = "desktop-v${version}";
|
||||||
|
hash = "sha256-NEsLQwcoQ2zTgznFgGFGNgYPnoclicNVycSEjl7I0Wo=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# The workspace has git deps in [patch.crates-io]; cargoHash covers them.
|
||||||
|
cargoHash = lib.fakeHash;
|
||||||
|
|
||||||
|
# Only this crate; the workspace has 30+ others (relay, db, ...).
|
||||||
|
cargoBuildFlags = [ "-p" "buzz-cli" ];
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Buzz CLI, the agent-facing command line for a Buzz relay";
|
||||||
|
homepage = "https://github.com/block/buzz";
|
||||||
|
license = lib.licenses.asl20;
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
mainProgram = "buzz";
|
||||||
|
};
|
||||||
|
}
|
||||||
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Bump buzz-cli to a new version.
|
||||||
|
# Usage: ./update.sh [<version>]
|
||||||
|
# With version: bump to that version.
|
||||||
|
# Without args: auto-detect latest from GitHub releases.
|
||||||
|
# Uses the same desktop-v* tag as buzz-desktop. cargoHash needs a build,
|
||||||
|
# so it is reset to lib.fakeHash; build once and paste the "got:" hash.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PKG="buzz-cli"
|
||||||
|
REPO="block/buzz"
|
||||||
|
|
||||||
|
if [ $# -ge 1 ]; then
|
||||||
|
VERSION="$1"
|
||||||
|
else
|
||||||
|
echo "Auto-detecting latest buzz-cli version..."
|
||||||
|
VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases" \
|
||||||
|
| jq -r '[.[] | select(.tag_name | startswith("desktop-v")) | .tag_name | sub("^desktop-v"; "")] | .[0]')
|
||||||
|
if [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; then
|
||||||
|
echo "Could not auto-detect latest version from GitHub."
|
||||||
|
echo "Usage: $0 [<version>]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Latest: $VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
HASH=$(nix flake prefetch "github:${REPO}/desktop-v${VERSION}" --json | jq -r '.hash')
|
||||||
|
if [ -z "$HASH" ] || [ "$HASH" = "null" ]; then
|
||||||
|
echo "Could not prefetch tag desktop-v${VERSION}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i "s/version = \".*\";/version = \"${VERSION}\";/" default.nix
|
||||||
|
sed -i "s|hash = .*;|hash = \"${HASH}\";|" default.nix
|
||||||
|
sed -i "s|cargoHash = .*;|cargoHash = lib.fakeHash;|" default.nix
|
||||||
|
|
||||||
|
echo "✅ ${PKG} bumped to ${VERSION}"
|
||||||
|
echo " Next: build once, then paste the cargoHash from the \"got:\" line."
|
||||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user