From 86ba936405142de87b9e575886548eb34218ab13 Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Sat, 18 Oct 2025 14:26:32 +0200 Subject: [PATCH] Refactor justfile --- justfile | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/justfile b/justfile index da74345..3c5bff8 100644 --- a/justfile +++ b/justfile @@ -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