install.sh

1.2 KB · raw

1#!/usr/bin/env bash2# Runs INSIDE the NixOS minimal installer (over serial) to lay down the golden3# system onto /dev/vda from the seed media. Driven by build-golden.sh.4set -euo pipefail5# Fast-fail signal for the driver instead of hanging until its timeout.6trap 'echo "=== NINA_INSTALL_FAIL ==="; sync; sleep 2; poweroff -f' ERR78SEED_DIR="$(cd "$(dirname "$0")" && pwd)"9echo "=== NINA_INSTALL_START ==="1011# Single BIOS-bootable ext4 root (MBR) — matches grub.device=/dev/vda.12parted -s /dev/vda mklabel msdos13parted -s /dev/vda mkpart primary ext4 1MiB 100%14parted -s /dev/vda set 1 boot on15udevadm settle || true16mkfs.ext4 -F -L nixos /dev/vda117udevadm settle || true1819# Mount the partition device directly — the /dev/disk/by-label symlink may not20# be populated by udev yet immediately after mkfs.21mount /dev/vda1 /mnt2223# Generate hardware-configuration.nix for this disk, then drop in our config.24nixos-generate-config --root /mnt25cp "$SEED_DIR/configuration.nix" /mnt/etc/nixos/configuration.nix2627# Bake the injected nina binary (prove-the-loop: absolute-path /root/nina).28install -Dm755 "$SEED_DIR/nina" /mnt/root/nina2930nixos-install --no-root-passwd --root /mnt3132echo "=== NINA_INSTALL_DONE ==="33sync34poweroff