diff --git a/.agents/skills/host-configuration/SKILL.md b/.agents/skills/host-configuration/SKILL.md index ffb7a08..bd45ec6 100644 --- a/.agents/skills/host-configuration/SKILL.md +++ b/.agents/skills/host-configuration/SKILL.md @@ -150,7 +150,7 @@ Generate: `nixos-generate-config --show-hardware-config` darwinConfigurations. = flakeHelpers.mkDarwinConfiguration ./hosts/machines/; ``` 4. Pick profiles — `developer` for any machine, `desktop` for GUI, `server` for headless -5. Add Makefile target (optional) +5. Add `justfile` target (optional) ## SSH Keys @@ -179,6 +179,6 @@ keys = [{ | Host | Platform | Profiles | Rebuild command | |------|----------|----------|-----------------| -| `nix-goldstar` | NixOS | developer + desktop + gaming | `make nix-goldstar` | -| `nix-oldstar` | NixOS | server | `make nix-oldstar` | -| `mac-brightstar` | Darwin | developer + desktop + macos | `make mac-brightstar` | +| `nix-goldstar` | NixOS | developer + desktop + gaming | `just nix-goldstar` | +| `nix-oldstar` | NixOS | server | `just nix-oldstar` | +| `mac-brightstar` | Darwin | developer + desktop + macos | `just mac-brightstar` | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b187d34..40b1e0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: paths: - '**.nix' - 'flake.lock' - - 'Makefile' + - 'justfile' - '.github/workflows/**' pull_request: branches: @@ -17,7 +17,7 @@ on: paths: - '**.nix' - 'flake.lock' - - 'Makefile' + - 'justfile' - '.github/workflows/**' concurrency: diff --git a/Makefile b/justfile similarity index 60% rename from Makefile rename to justfile index 0ab3135..4ddb8dd 100644 --- a/Makefile +++ b/justfile @@ -1,92 +1,99 @@ # ────────────────────────────────────────────────────────────────────────────── # dot — host management # -# make update Update all flake inputs (lock file) -# make fmt Format all Nix files -# make check nix flake check +# just update Update all flake inputs (lock file) +# just fmt Format all Nix files +# just check nix flake check # -# make all Switch all reachable hosts -# make mac-brightstar Switch the local Mac (darwin-rebuild) -# make nix-oldstar Rebuild nix-oldstar via SSH + nixos-rebuild -# make nix-goldstar Rebuild nix-goldstar via SSH + nixos-rebuild -# make nixos Rebuild all NixOS hosts -# make darwin Switch all Darwin hosts +# just all Switch all reachable hosts +# just mac-brightstar Switch the local Mac (darwin-rebuild) +# just nix-oldstar Rebuild nix-oldstar via SSH + nixos-rebuild +# just nix-goldstar Rebuild nix-goldstar via SSH + nixos-rebuild +# just nixos Rebuild all NixOS hosts +# just darwin Switch all Darwin hosts # ────────────────────────────────────────────────────────────────────────────── -.DEFAULT_GOAL := help -.PHONY: help all update fmt fmt-check lint check-hosts check \ - mac-brightstar \ - nix-oldstar nix-goldstar \ - nixos darwin - # ── Help ────────────────────────────────────────────────────────────────────── +[doc('Show available recipes')] help: @printf "\n \033[1mdot — host management\033[0m\n\n" - @printf " \033[36mmake all\033[0m Switch / deploy every host\n" - @printf " \033[36mmake darwin\033[0m Switch all Darwin (macOS) hosts\n" - @printf " \033[36mmake nixos\033[0m Rebuild all NixOS hosts via SSH\n" + @printf " \033[36mjust all\033[0m Switch / deploy every host\n" + @printf " \033[36mjust darwin\033[0m Switch all Darwin (macOS) hosts\n" + @printf " \033[36mjust nixos\033[0m Rebuild all NixOS hosts via SSH\n" @printf "\n" - @printf " \033[36mmake mac-brightstar\033[0m darwin-rebuild switch for mac-brightstar (this machine)\n" - @printf " \033[36mmake nix-oldstar\033[0m nixos-rebuild switch for nix-oldstar (remote)\n" - @printf " \033[36mmake nix-goldstar\033[0m nixos-rebuild switch for nix-goldstar (remote)\n" + @printf " \033[36mjust mac-brightstar\033[0m darwin-rebuild switch for mac-brightstar (this machine)\n" + @printf " \033[36mjust nix-oldstar\033[0m nixos-rebuild switch for nix-oldstar (remote)\n" + @printf " \033[36mjust nix-goldstar\033[0m nixos-rebuild switch for nix-goldstar (remote)\n" @printf "\n" - @printf " \033[36mmake update\033[0m nix flake update (refresh lock file)\n" - @printf " \033[36mmake fmt\033[0m nixpkgs-fmt on all *.nix files\n" - @printf " \033[36mmake fmt-check\033[0m Check formatting without modifying files\n" - @printf " \033[36mmake lint\033[0m Run deadnix and statix checks\n" - @printf " \033[36mmake check-hosts\033[0m Dry-run build/eval host configurations\n" - @printf " \033[36mmake check\033[0m Composite target (fmt-check + lint + check-hosts + flake check)\n" + @printf " \033[36mjust update\033[0m nix flake update (refresh lock file)\n" + @printf " \033[36mjust fmt\033[0m nixpkgs-fmt on all *.nix files\n" + @printf " \033[36mjust fmt-check\033[0m Check formatting without modifying files\n" + @printf " \033[36mjust lint\033[0m Run deadnix and statix checks\n" + @printf " \033[36mjust check-hosts\033[0m Dry-run build/eval host configurations\n" + @printf " \033[36mjust check\033[0m Composite target (fmt-check + lint + check-hosts + flake check)\n" @printf "\n" # ── Top-level targets ───────────────────────────────────────────────────────── +[doc('Switch / deploy every host')] all: darwin nixos +[doc('Switch all Darwin (macOS) hosts')] darwin: mac-brightstar +[doc('Rebuild all NixOS hosts via SSH')] nixos: nix-oldstar nix-goldstar # ── Darwin hosts ────────────────────────────────────────────────────────────── # mac-brightstar is the machine you're usually sitting at, so we run # darwin-rebuild directly (no SSH needed). +[doc('darwin-rebuild switch for mac-brightstar (local)')] mac-brightstar: @printf "\033[1m\033[32m▶ Switching mac-brightstar (local)…\033[0m\n" - sudo SSH_AUTH_SOCK=$$SSH_AUTH_SOCK darwin-rebuild switch --flake .#mac-brightstar + sudo SSH_AUTH_SOCK=$SSH_AUTH_SOCK darwin-rebuild switch --flake .#mac-brightstar # ── NixOS hosts (SSH + nixos-rebuild) ───────────────────────────────────────── # SSH into the remote host, pull latest config, and nixos-rebuild switch. # Each host has DOTFILES_DIR set in its NixOS config. +[doc('nixos-rebuild switch for nix-oldstar (remote)')] nix-oldstar: @printf "\033[1m\033[32m▶ Rebuilding nix-oldstar…\033[0m\n" - ssh -t nix-oldstar 'cd $${DOTFILES_DIR:-$$HOME/Workspaces/gdr/dot} && git pull && sudo nixos-rebuild switch --flake .#nix-oldstar' + ssh -t nix-oldstar 'cd ${DOTFILES_DIR:-$HOME/Workspaces/gdr/dot} && git pull && sudo nixos-rebuild switch --flake .#nix-oldstar' +[doc('nixos-rebuild switch for nix-goldstar (remote)')] nix-goldstar: @printf "\033[1m\033[32m▶ Rebuilding nix-goldstar…\033[0m\n" - ssh -t nix-goldstar 'cd $${DOTFILES_DIR:-$$HOME/Workspaces/gdr/dot} && git pull && sudo nixos-rebuild switch --flake .#nix-goldstar' + ssh -t nix-goldstar 'cd ${DOTFILES_DIR:-$HOME/Workspaces/gdr/dot} && git pull && sudo nixos-rebuild switch --flake .#nix-goldstar' # ── Maintenance ─────────────────────────────────────────────────────────────── +[doc('nix flake update (refresh lock file)')] update: @printf "\033[1m\033[32m▶ Updating flake inputs…\033[0m\n" nix flake update +[doc('nixpkgs-fmt on all *.nix files')] fmt: @printf "\033[1m\033[32m▶ Formatting Nix files…\033[0m\n" nix run nixpkgs#nixpkgs-fmt -- . +[doc('Check formatting without modifying files')] fmt-check: @printf "\033[1m\033[32m▶ Checking Nix formatting…\033[0m\n" nix run nixpkgs#nixpkgs-fmt -- --check . +[doc('Run deadnix and statix checks')] lint: @printf "\033[1m\033[32m▶ Running deadnix & statix…\033[0m\n" nix run nixpkgs#deadnix -- --fail --no-lambda-pattern-names --no-lambda-arg . nix run nixpkgs#statix -- check . +[doc('Dry-run build/eval host configurations')] check-hosts: @printf "\033[1m\033[32m▶ Evaluating system host configurations…\033[0m\n" nix build .#nixosConfigurations.nix-goldstar.config.system.build.toplevel --dry-run nix build .#nixosConfigurations.nix-oldstar.config.system.build.toplevel --dry-run nix eval .#darwinConfigurations.mac-brightstar.config.system.build.toplevel.drvPath +[doc('Composite target (fmt-check + lint + check-hosts + flake check)')] check: fmt-check lint check-hosts @printf "\033[1m\033[32m▶ Running nix flake check…\033[0m\n" nix flake check --all-systems