ljljkajkladjkl
This commit is contained in:
49
justfile
49
justfile
@@ -10,19 +10,23 @@ export FZF_DEFAULT_OPTS := "--height 15 --cycle --bind 'ctrl-a:toggle-all' " + e
|
||||
@_default:
|
||||
just "$(gum filter --placeholder "Pick a recipie..." $(just --summary --unsorted))"
|
||||
|
||||
# @eval $hostname=`just _a_host` $attrpath="" *_="_sentinel_":
|
||||
@eval $hostname=`just _a_host` $attrpath="" *_:
|
||||
attrpath="${attrpath:-system.build.toplevel.outPath}"; \
|
||||
args=("${@:3}"); \
|
||||
# [[ "${args[0]}" != "_sentinel_" ]] || args=("${args[@]:1}"); \
|
||||
set -x; nix eval ".#nixosConfigurations.\"$hostname\".config.$attrpath" --show-trace "${args[@]}"
|
||||
# @eval-vm $hostname=`just _a_host` $attrpath="" *_="_sentinel_":
|
||||
@eval-vm $hostname=`just _a_host` $attrpath="" *_:
|
||||
# @val $hostname=`just _a_host` $attrpath="" *_="_sentinel_":
|
||||
eval $hostname=`just _a_host` $attrpath="" *_:
|
||||
#!/usr/bin/env -S bash -euo pipefail
|
||||
attrpath="${attrpath:-system.build.toplevel.outPath}"
|
||||
args=("${@:3}")
|
||||
# [[ "${args[0]}" != "_sentinel_" ]] || args=("${args[@]:1}")
|
||||
set -x
|
||||
nix eval ".#nixosConfigurations.\"$hostname\".config.$attrpath" --show-trace "${args[@]}"
|
||||
# @val-vm $hostname=`just _a_host` $attrpath="" *_="_sentinel_":
|
||||
eval-vm $hostname=`just _a_host` $attrpath="" *_:
|
||||
#!/usr/bin/env -S bash -euo pipefail
|
||||
# nix eval ".#nixosConfigurations.\"$hostname\".config.system.build.vm.outPath" --show-trace "${@:2}"
|
||||
attrpath="${attrpath:-system.build.toplevel.outPath}"; \
|
||||
args=("${@:3}"); \
|
||||
# [[ "${args[0]}" != "_sentinel_" ]] || args=("${args[@]:1}"); \
|
||||
set -x; nix eval ".#nixosConfigurations.\"$hostname\".config.virtualisation.vmVariant.$attrpath" --show-trace "${args[@]}"
|
||||
attrpath="${attrpath:-system.build.toplevel.outPath}"
|
||||
args=("${@:3}")
|
||||
# [[ "${args[0]}" != "_sentinel_" ]] || args=("${args[@]:1}")
|
||||
set -x
|
||||
nix eval ".#nixosConfigurations.\"$hostname\".config.virtualisation.vmVariant.$attrpath" --show-trace "${args[@]}"
|
||||
|
||||
repl $hostname=`just _a_host`:
|
||||
NIX_NO_NOM=1 nixos-rebuild --flake .#"$hostname" repl
|
||||
@@ -314,11 +318,24 @@ _remote_ensure $hostname=`just _a_fqdn`:
|
||||
@_remote_label_from_fqdn hostname=`just _a_fqdn`:
|
||||
tomlq <.remote.toml '.hosts | to_entries[] | select(.value.host == "{{ hostname }}") | .key+1' -r
|
||||
|
||||
# TODO: 'tmux new $cmd \; set-option destroy-unattached' instead of NIX_NO_NOM
|
||||
@remote-mprocs +$cmd=`printf "just %s\n" $(just --summary --unsorted) | gum filter --placeholder "Pick a recipie..."`:
|
||||
just _some_remote_labels | sed -E 's/(.*)/remote --label="\1" "env NIX_NO_NOM=1 $cmd"/g' | xargs -d'\n' mprocs
|
||||
remote-mprocs *cmd:
|
||||
#!/usr/bin/env -S bash -euo pipefail
|
||||
declare -a cmd=("$@")
|
||||
if [[ "${#cmd[@]}" -eq 0 ]]; then
|
||||
cmd=($(just --summary --unsorted | xargs printf "just %s\n" | gum filter --placeholder "Pick a recipie..."))
|
||||
[[ "${#cmd[@]}" -gt 0 ]]
|
||||
fi
|
||||
escaped_cmd="$(printf "%q " "${cmd[@]}")"
|
||||
declare -a labels=()
|
||||
declare -a names=()
|
||||
label_names=$(just _some_remote_label_names | grep .)
|
||||
readarray -td $'\n' labels < <( cut -f1 <<<"$label_names" )
|
||||
readarray -td $'\n' names < <( cut -f2 <<<"$label_names" )
|
||||
# TODO: when tmux exits the output is cleared
|
||||
# printf "remote --label=%q \"env NIX_NO_NOM=1 ${escaped_cmd//%/%%}\"\n" "${labels[@]}" | xargs -d'\n' mprocs --names "$(IFS=','; printf "%s" "${labels[*]}")"
|
||||
printf "tmux new \"remote --label=%q ${escaped_cmd//%/%%} ; read\" \; set-option destroy-unattached\n" "${labels[@]}" | xargs -d'\n' mprocs --names "$(IFS=','; printf "%s" "${names[*]}")"
|
||||
|
||||
@remote-mprocs-new +$cmd=`printf "just %s\n" $(just --summary --unsorted) | gum filter --placeholder "Pick a recipie..."`:
|
||||
@remote-mprocs-init +$cmd=`printf "just %s\n" $(just --summary --unsorted) | gum filter --placeholder "Pick a recipie..."`:
|
||||
just _some_fqdns | xe -s 'just _remote_ensure "$1"; just _remote_label_from_fqdn "$1"' | sed -E 's/(.*)/remote --label="\1" "env NIX_NO_NOM=1 $cmd"/g' | xargs -d'\n' mprocs
|
||||
|
||||
# TODO: support multiple labels, run in tmux
|
||||
|
||||
@@ -198,7 +198,7 @@ in
|
||||
htmlq # html css queries
|
||||
(pkgs.xan or null) # a jq for csv, zsv
|
||||
# xee # xml xpath queries
|
||||
just # justfile
|
||||
pkgs.unstable.just # justfile
|
||||
gum
|
||||
mprocs
|
||||
systemctl-tui
|
||||
|
||||
Reference in New Issue
Block a user