This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.deploy: add --yes to switch without asking

+24 -9
+7 -1
AGENTS.md
··· 39 39 # decrypts each secret separately and fails on the Secure Enclave prompt. 40 40 s deploy --flake . <MACHINE_NAME> 41 41 42 + # Agents: deploy only when the user asked for it, and then always with 43 + # --yes. Without it the run stops at the [y/N] switch prompt (and the source 44 + # diff can wait in a pager) and looks hung. --yes skips both; the diffs are 45 + # still printed, so read them in the output afterwards. 46 + s deploy --flake . --yes <MACHINE_NAME> 47 + 42 48 # Format code 43 49 nix fmt 44 50 ··· 91 97 2. Add `config.nix`, `physical.nix`, and optionally `disk.nix` 92 98 3. Generate facts using clan-cli 93 99 4. Add to inventory in `flake.nix` 94 - 5. Deploy using `s deploy --flake . <name>` 100 + 5. Deploy using `s deploy --flake . <name>` (agents add `--yes`) 95 101 96 102 ## Pre-Commit 97 103
+16 -8
tools/deploy/flake-module.nix
··· 7 7 ... 8 8 }: 9 9 { 10 - # deploy [--flake PATH] <machine> [[user@]host] (host defaults to <machine>.r) 10 + # deploy [--flake PATH] [--yes] <machine> [[user@]host] (host defaults to <machine>.r) 11 11 # 12 12 # Generates vars, copies the flake source to /var/lib/deploy/incoming 13 13 # on the target, builds it there in the systemd unit deploy-build 14 14 # (progress via nom), shows the source diff against the running system 15 - # (/var/lib/deploy/src) and the closure diff, asks, then uploads 15 + # (/var/lib/deploy/src) and the closure diff, asks (--yes: does not 16 + # ask and prints the diffs without a pager), then uploads 16 17 # secrets and switches in the unit deploy-switch. Both units survive 17 18 # the ssh connection dying; rerunning deploy attaches to a running one. 18 19 packages.deploy = ··· 28 29 ]; 29 30 text = '' 30 31 usage() { 31 - echo "usage: deploy [--flake PATH] <machine> [[user@]host] (host defaults to <machine>.r)" >&2 32 + echo "usage: deploy [--flake PATH] [--yes] <machine> [[user@]host] (host defaults to <machine>.r)" >&2 32 33 exit 1 33 34 } 34 35 35 36 flake=. 37 + yes=0 36 38 while [ $# -gt 0 ]; do 37 39 case $1 in 38 40 --flake) 39 41 [ $# -ge 2 ] || usage 40 42 flake=$2 41 43 shift 2 44 + ;; 45 + --yes | -y) 46 + yes=1 47 + shift 42 48 ;; 43 49 -*) usage ;; 44 50 *) break ;; ··· 70 76 printf '\n\033[1m== %s\033[0m\n' "$*" >&2 71 77 } 72 78 page() { 73 - if [ -t 1 ]; then ''${PAGER:-less -RFX}; else cat; fi 79 + if [ -t 1 ] && [ "$yes" = 0 ]; then ''${PAGER:-less -RFX}; else cat; fi 74 80 } 75 81 76 82 # True while the unit's ExecStartPre or ExecStart is running. ··· 213 219 remote "$state/result-1/bin/nvd diff /run/current-system $system" 214 220 fi 215 221 216 - read -r -p "switch $target to $system? [y/N] " answer </dev/tty 217 - if [[ $answer != [yY]* ]]; then 218 - echo "aborted, $target is unchanged" >&2 219 - exit 1 222 + if [ "$yes" = 0 ]; then 223 + read -r -p "switch $target to $system? [y/N] " answer </dev/tty 224 + if [[ $answer != [yY]* ]]; then 225 + echo "aborted, $target is unchanged" >&2 226 + exit 1 227 + fi 220 228 fi 221 229 222 230 step "uploading secrets"
+1
tools/deploy/usage.kdl
··· 4 4 flag "--flake" help="Path to the flake (default: .)" { 5 5 arg "<path>" 6 6 } 7 + flag "-y --yes" help="Switch without asking; diffs are printed without a pager" 7 8 arg "<machine>" help="Machine configuration to deploy" 8 9 arg "[target_host]" help="SSH destination to deploy to, [user@]host (default: <machine>.r, user defaults to root)"