2010-10-21 23:50:12 +01:00
|
|
|
#! @shell@ -e
|
|
|
|
|
|
|
|
# Shows the usage of this command to the user
|
|
|
|
|
2013-10-11 13:12:36 +01:00
|
|
|
showUsage() {
|
|
|
|
exec man nixos-build-vms
|
|
|
|
exit 1
|
2010-10-21 23:50:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Parse valid argument options
|
|
|
|
|
2011-01-17 16:15:59 +00:00
|
|
|
PARAMS=`getopt -n $0 -o h -l no-out-link,show-trace,help -- "$@"`
|
2010-10-21 23:50:12 +01:00
|
|
|
|
|
|
|
if [ $? != 0 ]
|
|
|
|
then
|
|
|
|
showUsage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
eval set -- "$PARAMS"
|
|
|
|
|
|
|
|
# Evaluate valid options
|
|
|
|
|
|
|
|
while [ "$1" != "--" ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
2010-12-06 22:02:37 +00:00
|
|
|
--no-out-link)
|
|
|
|
noOutLinkArg="--no-out-link"
|
|
|
|
;;
|
2010-10-21 23:50:12 +01:00
|
|
|
--show-trace)
|
|
|
|
showTraceArg="--show-trace"
|
|
|
|
;;
|
|
|
|
-h|--help)
|
|
|
|
showUsage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2010-12-06 22:02:37 +00:00
|
|
|
shift
|
|
|
|
|
2010-10-21 23:50:12 +01:00
|
|
|
# Validate the given options
|
|
|
|
|
2013-07-03 10:13:58 +01:00
|
|
|
if [ "$1" = "" ]
|
2010-10-21 23:50:12 +01:00
|
|
|
then
|
2010-12-06 22:02:37 +00:00
|
|
|
echo "ERROR: A network expression must be specified!" >&2
|
|
|
|
exit 1
|
|
|
|
else
|
2013-07-03 10:13:58 +01:00
|
|
|
networkExpr=$(readlink -f $1)
|
2010-10-21 23:50:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Build a network of VMs
|
|
|
|
|
2015-08-05 14:52:12 +01:00
|
|
|
nix-build '<nixpkgs/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix>' \
|
2013-07-03 10:13:58 +01:00
|
|
|
--argstr networkExpr $networkExpr $noOutLinkArg $showTraceArg
|