at 22.05-pre 1.0 kB view raw
1#! @runtimeShell@ -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 12nixBuildArgs=() 13networkExpr= 14 15while [ $# -gt 0 ]; do 16 case "$1" in 17 --no-out-link) 18 nixBuildArgs+=("--no-out-link") 19 ;; 20 --show-trace) 21 nixBuildArgs+=("--show-trace") 22 ;; 23 -h|--help) 24 showUsage 25 exit 0 26 ;; 27 --option) 28 shift 29 nixBuildArgs+=("--option" "$1" "$2"); shift 30 ;; 31 *) 32 if [ ! -z "$networkExpr" ]; then 33 echo "Network expression already set!" 34 showUsage 35 exit 1 36 fi 37 networkExpr="$(readlink -f $1)" 38 ;; 39 esac 40 41 shift 42done 43 44if [ -z "$networkExpr" ] 45then 46 echo "ERROR: A network expression must be specified!" >&2 47 exit 1 48fi 49 50# Build a network of VMs 51nix-build '<nixpkgs/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix>' \ 52 --argstr networkExpr $networkExpr "${nixBuildArgs[@]}"