nixpkgs/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh
Sander van der Burg 755c30c7a2 - nixos-deploy-network no longer uses an infrastructure model => use nixpkgs.system and deployment.hostname instead
- implemented --no-out-link option so that invoking these tools from scripts leave no garbage behind
- some misc. cleanups


svn path=/nixos/trunk/; revision=25019
2010-12-06 22:02:37 +00:00

68 lines
1.1 KiB
Bash

#! @shell@ -e
# Shows the usage of this command to the user
showUsage()
{
echo "Usage: $0 network_expr"
echo "Options:"
echo
echo "--show-trace Shows an output trace"
echo "--no-out-link Do not create a 'result' symlink"
echo "-h,--help Shows the usage of this command"
}
# Parse valid argument options
PARAMS=`getopt -n $0 -o h -l show-trace,no-out-link,help -- "$@"`
if [ $? != 0 ]
then
showUsage
exit 1
fi
eval set -- "$PARAMS"
# Evaluate valid options
while [ "$1" != "--" ]
do
case "$1" in
--show-trace)
showTraceArg="--show-trace"
;;
--no-out-link)
noOutLinkArg="--no-out-link"
;;
-h|--help)
showUsage
exit 0
;;
esac
shift
done
shift
# Validate the given options
if [ -z "$NIXOS" ]
then
NIXOS=/etc/nixos/nixos
fi
if [ "$@" = "" ]
then
echo "ERROR: A network Nix expression must be specified!" >&2
exit 1
else
networkExpr=$(readlink -f $@)
fi
# Deploy the network
vms=`nix-build $NIXOS/modules/installer/tools/nixos-deploy-network/deploy.nix --argstr networkExpr $networkExpr $showTraceArg $noOutLinkArg`
$vms/bin/deploy-systems