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
|
||||
use flake .#envrc-remote
|
||||
echo
|
||||
just list-remotes
|
||||
just remote-current
|
||||
just remote-list
|
||||
echo
|
||||
fi
|
||||
|
||||
|
|
30
justfile
30
justfile
|
@ -1,10 +1,7 @@
|
|||
@_default:
|
||||
#just --choose # TODO: achieve something better with `gum`
|
||||
#just --list --list-prefix ' just '
|
||||
just "$(gum choose $(just --summary --unsorted))"
|
||||
export GUM_FILTER_HEIGHT := "15"
|
||||
|
||||
@set-remote:
|
||||
tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)" | @sh "\(.)"' -r | xargs gum choose | sh
|
||||
@_default:
|
||||
just "$(gum filter --placeholder "Pick a recipie..." $(just --summary --unsorted))"
|
||||
|
||||
eval hostname=`just _a-host`:
|
||||
nix eval .#nixosConfigurations.{{hostname}}.config.system.build.toplevel.outPath
|
||||
|
@ -35,9 +32,22 @@ switch:
|
|||
boot:
|
||||
sudo nixos-rebuild boot --flake .
|
||||
|
||||
@list-remotes:
|
||||
echo Current remote: $(remote-host)
|
||||
@_a-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
|
||||
|
||||
@_a-host:
|
||||
nix eval .#nixosHostnames --json 2>/dev/null | jq '.[]' -r | gum filter --height 10 --placeholder "Pick a host..."
|
||||
@_a-remote-label:
|
||||
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