just timeout

This commit is contained in:
Peder Bergebakken Sundt 2024-10-10 21:08:00 +02:00
parent 6132cb3c9a
commit 9bc3213367
1 changed files with 10 additions and 2 deletions

View File

@ -28,10 +28,12 @@ update:
| gum choose --no-limit --height=15 \
| xargs nix flake update --commit-lock-file
build hostname=`if test -z "${IS_REMOTE_ENV:-}"; then just _a_host; else echo; fi`:
#build hostname=`if test -z "${IS_REMOTE_ENV:-}"; then just _a_host_timeout; else echo; fi`:
build hostname="":
nixos-rebuild build --accept-flake-config --show-trace --flake .#"{{hostname}}"
build-no-remote-builders hostname=`if test -z "$IS_REMOTE_ENV"; then just _a_host; else echo; fi`:
#build-no-remote-builders hostname=`if test -z "$IS_REMOTE_ENV"; then just _a_host_timeout; else echo; fi`:
build-no-remote-builders hostname="":
nixos-rebuild build --accept-flake-config --show-trace --flake .#"{{hostname}}" --builders ""
build-vm hostname=`just _a_host`:
@ -67,6 +69,12 @@ inspect-config host=`just _a_host` prefix="":
if test "$(grep <<<"$hostnames" "^$(hostname)$" | wc -l)" -eq 1; then hostnames="$(hostname; grep <<<"$hostnames" -v "^$(hostname)$")"; fi; \
gum <<<"$hostnames" filter --placeholder "Pick a host..."
# ctrl-c is counted as a timeout...
@_a_host_timeout:
hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json 2>/dev/null | jq '.[]' -r)"; \
if test "$(grep <<<"$hostnames" "^$(hostname)$" | wc -l)" -eq 1; then hostnames="$(hostname; grep <<<"$hostnames" -v "^$(hostname)$")"; fi; \
gum <<<"$hostnames" filter --placeholder "Pick a host..." --timeout 5s || hostname
@_some_hosts:
hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json 2>/dev/null | jq '.[]' -r)"; \
if test "$(grep <<<"$hostnames" "^$(hostname)$" | wc -l)" -eq 1; then hostnames="$(hostname; grep <<<"$hostnames" -v "^$(hostname)$")"; fi; \