nixpkgs/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh
Sander van der Burg deb6cce4bb Adapted deploy-network to accept multiple network configurations which are zipped together. With this you can run the tool like this:
$ nixos-deploy-network network1.nix network2.nix


svn path=/nixos/trunk/; revision=27028
2011-04-28 11:02:58 +00:00

71 lines
1.2 KiB
Bash

#! @shell@ -e
# Shows the usage of this command to the user
showUsage()
{
echo "Usage: $0 network_expr [network_expr2 ...]"
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: At least one network Nix expression must be specified!" >&2
exit 1
else
for i in $@
do
networkExprs="$networkExprs \"$(readlink -f $i)\""
done
fi
# Deploy the network
vms=`nix-build $NIXOS/modules/installer/tools/nixos-deploy-network/deploy.nix --arg networkExprs "[ $networkExprs ]" --argstr nixos $NIXOS $showTraceArg $noOutLinkArg`
$vms/bin/deploy-systems