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