diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..5bab3f5 --- /dev/null +++ b/Justfile @@ -0,0 +1,25 @@ +nixos_rebuild := "github:NixOS/nixpkgs/nixos-25.11#nixos-rebuild" + +# List available homelab commands. +default: + @just --list + +# Activate a host configuration without making it the boot default. +[group('homelab')] +test host: + @just _rebuild {{ host }} test + +# Activate a host configuration and make it the boot default. +[group('homelab')] +switch host: + @just _rebuild {{ host }} switch + +_rebuild host action: + @case "{{ host }}" in yggdrasil|midgard) ;; *) echo "unknown host: {{ host }}" >&2; exit 2;; esac + nix run {{ nixos_rebuild }} -- \ + {{ action }} \ + --fast \ + --flake ".#{{ host }}" \ + --build-host "{{ host }}" \ + --target-host "{{ host }}" \ + --use-remote-sudo