diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4f2c458..fb4d76a 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,4 +1,4 @@ -# Runs on the Nix runner on nexus (label `nixos`, host executor). +# Runs on a self-hosted Nix runner (label `nixos`, host executor). name: ci on: [push, pull_request] diff --git a/README.md b/README.md index 3aeba05..786ea24 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,11 @@ change its own code. ## Start -You need [Nix](https://nixos.org/download) with flakes. +You need [Nix](https://nixos.org/download) with flakes, and an API token for +an LLM (OpenAI Responses or Anthropic Messages API). ```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 ``` @@ -26,12 +28,13 @@ 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 # or .#loop-internal (Gitea on the LAN) +nix run .#loop -- my-world ``` -The loop runs `nix run --refresh git+ssh://…/surma/sausage -- run my-world`. +The loop runs `nix run --refresh git+https://gitea.surma.technology/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. +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. In the console: diff --git a/flake.nix b/flake.nix index 576e530..6fa8678 100644 --- a/flake.nix +++ b/flake.nix @@ -36,15 +36,14 @@ meta.mainProgram = "sausage"; }; # `nix run .#loop -- ` runs the newest `sausage run ` - # from the Gitea repo, again and again: after a crash or a broker + # from the public 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. - # `--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 + # 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}}" if [ $# -eq 0 ]; then set -- world; fi while true; do nix run --refresh "$url#default" -- run "$@" @@ -72,8 +71,7 @@ }); apps.default = { type = "app"; program = "${sausage}/bin/sausage"; }; - 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"; }; + apps.loop = { type = "app"; program = "${loop}/bin/sausage-loop"; }; devShells.default = pkgs.mkShell { packages = [ rust pkgs.wasmtime pkgs.wasm-tools ];