1#! @shell@ -e
2
3# Shows the usage of this command to the user
4
5showUsage() {
6 exec man nixos-build-vms
7 exit 1
8}
9
10# Parse valid argument options
11
12PARAMS=`getopt -n $0 -o h -l no-out-link,show-trace,help -- "$@"`
13
14if [ $? != 0 ]
15then
16 showUsage
17 exit 1
18fi
19
20eval set -- "$PARAMS"
21
22# Evaluate valid options
23
24while [ "$1" != "--" ]
25do
26 case "$1" in
27 --no-out-link)
28 noOutLinkArg="--no-out-link"
29 ;;
30 --show-trace)
31 showTraceArg="--show-trace"
32 ;;
33 -h|--help)
34 showUsage
35 exit 0
36 ;;
37 esac
38
39 shift
40done
41
42shift
43
44# Validate the given options
45
46if [ "$1" = "" ]
47then
48 echo "ERROR: A network expression must be specified!" >&2
49 exit 1
50else
51 networkExpr=$(readlink -f $1)
52fi
53
54# Build a network of VMs
55
56nix-build '<nixpkgs/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix>' \
57 --argstr networkExpr $networkExpr $noOutLinkArg $showTraceArg