Run without a clone: bare sausage creates ./world if needed and runs it
ci / check (push) Successful in 14m24s
ci / check (push) Successful in 14m24s
- cli: the subcommand is optional; without one, sausage runs ./world and runs init first when ./world is not a world yet (test: cli/tests/cli.rs). - flake: .#loop without a folder runs bare sausage. - README: nix run git+https://gitea.surma.technology/surma/sausage(#loop), clone only for working on Sausage.
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
meta.mainProgram = "sausage";
|
||||
};
|
||||
# `nix run .#loop -- <world>` runs the newest `sausage run <world>`
|
||||
# (without a folder: bare `sausage`, i.e. ./world, created if needed)
|
||||
# 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.
|
||||
@@ -44,9 +45,10 @@
|
||||
repoUrl = "git+https://gitea.surma.technology/surma/sausage";
|
||||
loop = pkgs.writeShellScriptBin "sausage-loop" ''
|
||||
url="''${SAUSAGE_FLAKE:-${repoUrl}}"
|
||||
if [ $# -eq 0 ]; then set -- world; fi
|
||||
# No folder: bare `sausage` (creates ./world first if needed).
|
||||
if [ $# -gt 0 ]; then set -- run "$@"; fi
|
||||
while true; do
|
||||
nix run --refresh "$url#default" -- run "$@"
|
||||
nix run --refresh "$url#default" -- "$@"
|
||||
code=$?
|
||||
if [ "$code" -eq 0 ]; then exit 0; fi
|
||||
echo "sausage-loop: sausage exited with $code, starting the newest version in 2 s …" >&2
|
||||
|
||||
Reference in New Issue
Block a user