#!/usr/bin/env bash set -euo pipefail # PlasmaCloud VM Cluster - Node 01 (ISO Boot) # Boots from PlasmaCloud ISO for manual NixOS installation SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DISK="${SCRIPT_DIR}/node01.qcow2" ISO="${SCRIPT_DIR}/isos/latest-nixos-minimal-x86_64-linux.iso" MAC_MCAST="52:54:00:12:34:01" MAC_SLIRP="52:54:00:aa:bb:01" MCAST_ADDR="230.0.0.1:1234" SSH_PORT=2201 VNC_DISPLAY=":1" SERIAL_LOG="${SCRIPT_DIR}/node01-serial.log" # Verify ISO exists if [ ! -f "$ISO" ]; then echo "ERROR: ISO not found at $ISO" exit 1 fi echo "Launching node01 with ISO boot..." echo " Disk: ${DISK}" echo " ISO: ${ISO}" echo " eth0 (multicast): ${MAC_MCAST} @ ${MCAST_ADDR}" echo " eth1 (SLIRP): ${MAC_SLIRP}, SSH on host:${SSH_PORT}" echo " VNC: ${VNC_DISPLAY} (port 5901)" echo " Serial log: ${SERIAL_LOG}" exec qemu-system-x86_64 \ -name node01 \ -machine type=q35,accel=kvm \ -cpu host \ -smp 8 \ -m 16G \ -drive file="${DISK}",if=virtio,format=qcow2 \ -cdrom "${ISO}" \ -boot d \ -netdev socket,mcast="${MCAST_ADDR}",id=mcast0 \ -device virtio-net-pci,netdev=mcast0,mac="${MAC_MCAST}" \ -netdev user,id=user0,hostfwd=tcp::${SSH_PORT}-:22 \ -device virtio-net-pci,netdev=user0,mac="${MAC_SLIRP}" \ -vnc "${VNC_DISPLAY}" \ -serial "file:${SERIAL_LOG}" \ -daemonize