Refactor justfile

This commit is contained in:
SebastianStork 2025-10-18 14:26:32 +02:00
parent 33127ac79a
commit 86ba936405
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q

View file

@ -1,12 +1,8 @@
set quiet := true
default:
list:
just --list --unsorted
rebuild mode='switch':
nh os {{ if mode == 'reboot' { 'boot' } else { mode } }} .
{{ if mode == 'reboot' { 'reboot' } else { '' } }}
update:
nix flake update --commit-lock-file
@ -16,32 +12,59 @@ fmt:
check:
nix flake check --no-build
deploy +hosts:
deploy --skip-checks --targets $(echo {{ hosts }} | sed 's/[^ ]*/\.#&/g')
install host destination='root@installer':
nix run .#install-anywhere -- {{ host }} {{ destination }}
repair:
nix-store --verify --check-contents --repair
repl host='$(hostname)':
nix repl .#nixosConfigurations.{{ host }}
_sops-do command:
-if command -v sops >/dev/null 2>&1; then {{ command }}; else nix develop .#sops --command bash -c "{{ command }}; exec zsh"; fi
[group('rebuild')]
rebuild mode='switch':
nh os {{ mode }} .
[group('rebuild')]
switch:
rebuild switch
[group('rebuild')]
test:
just rebuild test
[group('rebuild')]
boot:
just rebuild boot
[group('rebuild')]
reboot:
just boot && reboot
[group('remote')]
deploy +hosts:
deploy --skip-checks --targets $(echo {{ hosts }} | sed 's/[^ ]*/\.#&/g')
[group('remote')]
install host destination='root@installer':
nix run .#install-anywhere -- {{ host }} {{ destination }}
[group('sops')]
sops-edit path:
just _sops-do "sops edit {{ path }}"
[group('sops')]
sops-update path:
just _sops-do "sops updatekeys {{ path }}"
[group('sops')]
sops-update-all:
just _sops-do "find . -type f -name 'secrets.json' -exec sops updatekeys --yes {} \;"
[group('sops')]
sops-rotate path:
just _sops-do "sops rotate --in-place {{ path }}"
[group('sops')]
sops-rotate-all:
just _sops-do "find . -type f -name 'secrets.json' -exec sops rotate --in-place {} \;"
_sops-do command:
-if command -v sops >/dev/null 2>&1; then {{ command }}; else nix develop .#sops --command bash -c "{{ command }}; exec zsh"; fi