mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
nyx: Added a debug option. cmd_ prefixes added.
This commit is contained in:
parent
fba377eab2
commit
f147297dac
1 changed files with 31 additions and 23 deletions
54
nyx
54
nyx
|
|
@ -2,37 +2,45 @@
|
|||
set -eu
|
||||
|
||||
usage() {
|
||||
echo example: $0 build samhain boot
|
||||
echo example: $0 build samhain boot
|
||||
}
|
||||
|
||||
deploy() {
|
||||
HOST=$1
|
||||
if [ $# -gt 2 ]; then
|
||||
METHOD=$2
|
||||
else
|
||||
METHOD="switch"
|
||||
fi
|
||||
|
||||
bash <(nix eval --raw deploy.${HOST} -f .) ${METHOD}
|
||||
eval_setup() {
|
||||
HOST=$1
|
||||
if [ $# -gt 2 ]; then
|
||||
METHOD=$2
|
||||
else
|
||||
METHOD="switch"
|
||||
fi
|
||||
}
|
||||
|
||||
install() {
|
||||
HOST=$1
|
||||
nix build -f . hosts.$HOST.config.system.build.toplevel
|
||||
CLOSURE=$(readlink result)
|
||||
nix-store --export $(nix-store -qR ./result) | ssh root@$HOST nix-store --import --store /mnt
|
||||
ssh root@$HOST nixos-install --system $CLOSURE
|
||||
cmd_deploy() {
|
||||
eval_setup $@
|
||||
bash <(nix eval --raw deploy.${HOST} -f .) ${METHOD}
|
||||
}
|
||||
|
||||
cmd_debug() {
|
||||
eval_setup $@
|
||||
nix eval --raw deploy.$HOST -f .
|
||||
}
|
||||
|
||||
cmd_install() {
|
||||
HOST=$1
|
||||
nix build -f . hosts.$HOST.config.system.build.toplevel
|
||||
CLOSURE=$(readlink result)
|
||||
nix-store --export $(nix-store -qR ./result) | ssh root@$HOST nix-store --import --store /mnt
|
||||
ssh root@$HOST nixos-install --system $CLOSURE
|
||||
}
|
||||
|
||||
main() {
|
||||
if [ $# -lt 2 ]; then
|
||||
usage
|
||||
else
|
||||
CMD=$1
|
||||
shift
|
||||
if [ $# -lt 2 ]; then
|
||||
usage
|
||||
else
|
||||
CMD=$1
|
||||
shift
|
||||
|
||||
$CMD $@
|
||||
fi
|
||||
cmd_$CMD $@
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue