1
0
nixfiles/deploy.sh
2020-12-20 00:05:08 +01:00

28 lines
446 B
Bash
Executable File

#!/usr/bin/env bash
DEPLOY_HOST=$1
DEPLOY_ADDRESS=$2
if [ -z $DEPLOY_HOST ]; then
exit 1
fi
cmd=" \
nixos-rebuild switch \
-I nixos-config=hosts/${DEPLOY_HOST}/configuration.nix \
"
if [ -z $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
eval ${cmd}