# homelab-iac justfile # Requires: just, op (1Password CLI), tofu, colmena, nix, ssh set shell := ["bash", "-euo", "pipefail", "-c"] # Default: list all recipes default: @just --list # ── Nix ──────────────────────────────────────────────────────────────────── # Evaluate all NixOS configs and check formatting check: cd nix && nix flake check --no-build # Format Nix and OpenTofu files fmt: cd nix && nix fmt || true cd terraform && tofu fmt # ── OpenTofu (credentials injected from 1Password) ───────────────────────── @tf +args: source .env && tofu -chdir=terraform {{args}} # Show planned infrastructure changes infra-plan: just tf plan # Apply infrastructure changes infra-apply: just tf apply # Destroy all infrastructure (prompts for confirmation) infra-destroy: just tf destroy # Show current infrastructure state infra-show: just tf show # ── NixOS Deployment ─────────────────────────────────────────────────────── # Deploy NixOS config to all hosts deploy *args: cd nix && op run --env-file="./.op-env" --no-masking -- colmena apply --impure {{args}} # Deploy NixOS config to a specific host, e.g.: just deploy-host media deploy-host host: just deploy --on {{ host }} # ── DNS ───────────────────────────────────────────────────────------------- dns-plan: cd dns && dnscontrol preview --creds '!op inject -i creds.json.tpl' dns-apply: cd dns && dnscontrol push --creds '!op inject -i creds.json.tpl'