refactor(ci): scripts

This commit is contained in:
arcnmx 2024-02-22 11:46:52 -08:00
parent c4fcb16fef
commit 5c73439cad
19 changed files with 288 additions and 207 deletions

23
ci/switch.sh Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -eu
ARG_NODE=$1
shift
ARG_HOSTNAME=$(nf-hostname "$ARG_NODE")
NIX_SSHOPTS=$(nf-sshopts "$ARG_NODE")
if [[ $# -gt 0 ]]; then
ARG_METHOD=$1
shift
else
ARG_METHOD=switch
fi
if [[ $ARG_HOSTNAME != root@ ]]; then
set -- --use-remote-sudo "$@"
fi
exec nixos-rebuild "$ARG_METHOD" \
--flake "${NF_CONFIG_ROOT}#${ARG_NODE}" \
--no-build-nix \
--target-host "$ARG_HOSTNAME" \
"$@"