#!/bin/execlineb -S1 # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2022 Alyssa Ross if -n { if -n { test $# -eq 1 -a $1 = switch } fdmove -c 1 2 echo "Usage: ${0} switch" } cd /run/virtiofs/virtiofs0 backtick -E dir { mktemp -d } foreground { if { nix-build -o ${dir}/system } if { nix-env -p nix/var/nix/profiles/vms --set ${dir}/system } backtick -E vmsdir { resolve_in_root . nix/var/nix/profiles/vms } cd $vmsdir elglob -0 glob * forx -E vm { $glob } ln -s /nix/var/nix/profiles/vms/${vm} /run/virtiofs/virtiofs0/svc/data } importas -iu ? ? background { rm -rf $dir } exit $?