add --show-flags and EXTRA_FLAGS to ./deploy

This commit is contained in:
Emile Clark-Boman 2026-01-31 10:14:46 +10:00
parent 0eec0a9ade
commit e14ebf98ca

24
deploy
View file

@ -9,6 +9,7 @@ Options:
-f, --fresh Remove old content in the nixstore (good for debugging) -f, --fresh Remove old content in the nixstore (good for debugging)
-b, --bootloader Reinstall the bootloader -b, --bootloader Reinstall the bootloader
-r, --remote Locally build and remotely deploy Colmena hive -r, --remote Locally build and remotely deploy Colmena hive
--show-trace Show nix stack trace on error
-h, --help Show this message (^_^)" -h, --help Show this message (^_^)"
# delete all cached entries # delete all cached entries
@ -31,7 +32,7 @@ rebuild_flake () {
# LOG="$(mktemp /tmp/rebuild-XXXXXXXX)" # LOG="$(mktemp /tmp/rebuild-XXXXXXXX)"
LOG="./rebuild.log" LOG="./rebuild.log"
echo "[*] Logging to $LOG" echo "[*] Logging to $LOG"
sudo nixos-rebuild switch --flake . $FLAGS 2>&1 | tee "$LOG" sudo nixos-rebuild switch --flake . $FLAGS $EXTRA_FLAGS 2>&1 | tee "$LOG"
#nixos-rebuild build --flake .# --cores 8 -j 1 #nixos-rebuild build --flake .# --cores 8 -j 1
} }
@ -42,19 +43,22 @@ deploy_hive () {
git add . --verbose git add . --verbose
# Deploy to all Colmena hives # Deploy to all Colmena hives
colmena build --experimental-flake-eval colmena build --experimental-flake-eval $EXTRA_FLAGS
colmena apply --experimental-flake-eval colmena apply --experimental-flake-eval $EXTRA_FLAGS
# colmena apply --on hyrule --experimental-flake-eval # colmena apply --on hyrule --experimental-flake-eval
} }
# check which flags were given # check which flags were given
flag_fresh=false flag_fresh=false
flag_bootloader=false flag_bootloader=false
flag_remote=false
flag_trace=false
for flag in "$@"; do for flag in "$@"; do
case "$flag" in case "$flag" in
-r|--remote) -r|--remote)
deploy_hive flag_remote=true ;;
exit 0 ;; --show-trace)
flag_trace=true ;;
-f|--fresh) -f|--fresh)
flag_fresh=true ;; flag_fresh=true ;;
-b|--bootloader) -b|--bootloader)
@ -68,6 +72,16 @@ for flag in "$@"; do
esac esac
done done
EXTRA_FLAGS=""
if [ "$flag_trace" = true ]; then
EXTRA_FLAGS="$EXTRA_FLAGS --show-trace"
fi
if [ "$flag_remote" = true ]; then
deploy_hive
exit 0
fi
# delete cached items in nixstore # delete cached items in nixstore
if [ "$flag_fresh" = true ]; then if [ "$flag_fresh" = true ]; then
collect_garbage collect_garbage