1
0
nixfiles/deploy.sh

28 lines
446 B
Bash
Raw Normal View History

2020-12-06 16:59:11 +01:00
#!/usr/bin/env bash
DEPLOY_HOST=$1
DEPLOY_ADDRESS=$2
2020-12-20 00:05:08 +01:00
if [ -z $DEPLOY_HOST ]; then
exit 1
fi
cmd=" \
2020-12-06 16:59:11 +01:00
nixos-rebuild switch \
-I nixos-config=hosts/${DEPLOY_HOST}/configuration.nix \
2020-12-20 00:05:08 +01:00
"
if [ -z $DEPLOY_ADDRESS ]; then
DEPLOY_ADDRESS="clerie@${DEPLOY_HOST}.net.clerie.de"
fi
if [ $DEPLOY_ADDRESS != "localhost" ]; then
cmd="${cmd} \
2020-12-06 18:03:45 +01:00
--target-host ${DEPLOY_ADDRESS} \
--build-host localhost \
2020-12-20 00:05:08 +01:00
--use-remote-sudo \
"
fi
eval ${cmd}