You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
584 B
32 lines
584 B
#!/usr/bin/env bash |
|
|
|
DEPLOY_HOST=$1 |
|
DEPLOY_ADDRESS=$2 |
|
DEPLOY_PORT=$3 |
|
|
|
if [ -z $DEPLOY_HOST ]; then |
|
exit 1 |
|
fi |
|
|
|
cmd=" \ |
|
nixos-rebuild switch \ |
|
-I nixos-config=hosts/${DEPLOY_HOST}/configuration.nix --show-trace\ |
|
" |
|
|
|
if [ -z $DEPLOY_ADDRESS ] || [ $DEPLOY_ADDRESS = "-" ]; then |
|
DEPLOY_ADDRESS="clerie@${DEPLOY_HOST}.net.clerie.de" |
|
fi |
|
|
|
if [ $DEPLOY_ADDRESS != "localhost" ]; then |
|
cmd="${cmd} \ |
|
--target-host ${DEPLOY_ADDRESS} \ |
|
--build-host localhost \ |
|
--use-remote-sudo \ |
|
" |
|
fi |
|
|
|
if [ -n "$DEPLOY_PORT" ]; then |
|
cmd="NIX_SSHOPTS=\"-p $DEPLOY_PORT\" ${cmd}" |
|
fi |
|
|
|
eval ${cmd}
|
|
|