Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4274f9fc5 | ||
|
|
842fe62c87 |
@@ -1,4 +1,4 @@
|
||||
# Runs on a self-hosted Nix runner (label `nixos`, host executor).
|
||||
# Runs on the Nix runner on nexus (label `nixos`, host executor).
|
||||
name: ci
|
||||
on: [push, pull_request]
|
||||
|
||||
|
||||
@@ -10,11 +10,9 @@ change its own code.
|
||||
|
||||
## Start
|
||||
|
||||
You need [Nix](https://nixos.org/download) with flakes, and an API token for
|
||||
an LLM (OpenAI Responses or Anthropic Messages API).
|
||||
You need [Nix](https://nixos.org/download) with flakes.
|
||||
|
||||
```sh
|
||||
git clone https://gitea.surma.technology/surma/sausage && cd sausage
|
||||
nix run -- init # creates ./world and builds the agent (a few minutes)
|
||||
nix run -- run # starts the world and a console
|
||||
```
|
||||
@@ -28,13 +26,12 @@ folder as an argument, for example `nix run -- run my-world`.
|
||||
To keep a world on the newest version, run it in a loop:
|
||||
|
||||
```sh
|
||||
nix run .#loop -- my-world
|
||||
nix run .#loop -- my-world # or .#loop-internal (Gitea on the LAN)
|
||||
```
|
||||
|
||||
The loop runs `nix run --refresh git+https://gitea.surma.technology/surma/sausage -- run my-world`.
|
||||
The loop runs `nix run --refresh git+ssh://…/surma/sausage -- run my-world`.
|
||||
When the host crashes or an actor sends `@broker {"type":"exit"}`, the loop
|
||||
fetches the newest commit and starts it again. `/quit` ends the loop. Set
|
||||
`SAUSAGE_FLAKE` to run another flake URL instead, for example your fork.
|
||||
fetches the newest commit and starts it again. `/quit` ends the loop.
|
||||
|
||||
In the console:
|
||||
|
||||
|
||||
@@ -36,14 +36,15 @@
|
||||
meta.mainProgram = "sausage";
|
||||
};
|
||||
# `nix run .#loop -- <world>` runs the newest `sausage run <world>`
|
||||
# from the public repo, again and again: after a crash or a broker
|
||||
# from the Gitea repo, again and again: after a crash or a broker
|
||||
# `exit` request it refreshes the flake and starts the host again,
|
||||
# so the world updates itself. `/quit` (exit code 0) ends the loop.
|
||||
# SAUSAGE_FLAKE overrides where it fetches from (any flake URL,
|
||||
# e.g. a fork or a local checkout).
|
||||
repoUrl = "git+https://gitea.surma.technology/surma/sausage";
|
||||
loop = pkgs.writeShellScriptBin "sausage-loop" ''
|
||||
url="''${SAUSAGE_FLAKE:-${repoUrl}}"
|
||||
# `--internal` (or `.#loop-internal`) uses Gitea's SSH port on the LAN.
|
||||
publicUrl = "git+ssh://containeruser@gitea.surma.technology:2222/surma/sausage";
|
||||
internalUrl = "git+ssh://containeruser@10.0.0.2:2222/surma/sausage";
|
||||
loop = name: url: pkgs.writeShellScriptBin name ''
|
||||
url="${url}"
|
||||
if [ "''${1:-}" = "--internal" ]; then url="${internalUrl}"; shift; fi
|
||||
if [ $# -eq 0 ]; then set -- world; fi
|
||||
while true; do
|
||||
nix run --refresh "$url#default" -- run "$@"
|
||||
@@ -71,7 +72,8 @@
|
||||
});
|
||||
|
||||
apps.default = { type = "app"; program = "${sausage}/bin/sausage"; };
|
||||
apps.loop = { type = "app"; program = "${loop}/bin/sausage-loop"; };
|
||||
apps.loop = { type = "app"; program = "${loop "sausage-loop" publicUrl}/bin/sausage-loop"; };
|
||||
apps.loop-internal = { type = "app"; program = "${loop "sausage-loop-internal" internalUrl}/bin/sausage-loop-internal"; };
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [ rust pkgs.wasmtime pkgs.wasm-tools ];
|
||||
|
||||
Reference in New Issue
Block a user