pinpin the justfile some more
This commit is contained in:
parent
bbb3b72b1e
commit
d73b1f10c4
3
.envrc
3
.envrc
|
@ -21,7 +21,8 @@ if ! test -s .remote.toml; then
|
||||||
else
|
else
|
||||||
use flake .#envrc-remote
|
use flake .#envrc-remote
|
||||||
echo
|
echo
|
||||||
just list-remotes
|
just remote-current
|
||||||
|
just remote-list
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
30
justfile
30
justfile
|
@ -1,10 +1,7 @@
|
||||||
@_default:
|
export GUM_FILTER_HEIGHT := "15"
|
||||||
#just --choose # TODO: achieve something better with `gum`
|
|
||||||
#just --list --list-prefix ' just '
|
|
||||||
just "$(gum choose $(just --summary --unsorted))"
|
|
||||||
|
|
||||||
@set-remote:
|
@_default:
|
||||||
tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)" | @sh "\(.)"' -r | xargs gum choose | sh
|
just "$(gum filter --placeholder "Pick a recipie..." $(just --summary --unsorted))"
|
||||||
|
|
||||||
eval hostname=`just _a-host`:
|
eval hostname=`just _a-host`:
|
||||||
nix eval .#nixosConfigurations.{{hostname}}.config.system.build.toplevel.outPath
|
nix eval .#nixosConfigurations.{{hostname}}.config.system.build.toplevel.outPath
|
||||||
|
@ -35,9 +32,22 @@ switch:
|
||||||
boot:
|
boot:
|
||||||
sudo nixos-rebuild boot --flake .
|
sudo nixos-rebuild boot --flake .
|
||||||
|
|
||||||
@list-remotes:
|
@_a-host:
|
||||||
echo Current remote: $(remote-host)
|
nix eval .#nixosHostnames --json 2>/dev/null | jq '.[]' -r | gum filter --placeholder "Pick a host..."
|
||||||
|
|
||||||
|
@remote-current:
|
||||||
|
>&2 echo Current remote: $(remote-host)
|
||||||
|
|
||||||
|
@remote-list:
|
||||||
tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r
|
tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r
|
||||||
|
|
||||||
@_a-host:
|
@_a-remote-label:
|
||||||
nix eval .#nixosHostnames --json 2>/dev/null | jq '.[]' -r | gum filter --height 10 --placeholder "Pick a host..."
|
just remote-list | gum filter --placeholder "Pick a remote..." | cut -d' ' -f2
|
||||||
|
|
||||||
|
@_a-remote-fqdn:
|
||||||
|
just remote-list | gum filter --placeholder "Pick a remote..." | cut -d' ' -f5-
|
||||||
|
|
||||||
|
@remote-set remote=`just remote-current && just _a-remote-label`:
|
||||||
|
remote-set {{remote}}
|
||||||
|
|
||||||
|
# nixos-rebuild --flake .#<host> --target-host root@<host>.nixos.org --use-substitutes switch
|
||||||
|
|
Loading…
Reference in New Issue