# The vmix "PE": Apple's Recovery (BaseSystem.dmg) with one LaunchDaemon added # that runs /Volumes/VMIX/run.sh as root at boot and powers off afterwards. # BaseSystem is a plain (journaled) HFS+ volume that Linux can write with the # hfsplus driver's force option — the pristine image's journal is empty, so this # is safe. The kernel and boot.efi are untouched; launchd loads the extra plist # from /System/Library/LaunchDaemons alongside its signed cache (verified on # Tahoe 26.6.2). Same idea as AutoNBI/Imagr NetBoot images. # Output: raw disk image (HFS+ volume with a partition table) that OpenCore boots. { pkgs, lib, ... }: { name ? "macos", recovery }: pkgs.runCommand "${name}-pe.img" { nativeBuildInputs = with pkgs; [ dmg2img libguestfs-with-appliance ]; } '' echo "=== vmix: building the recovery PE from BaseSystem.dmg ===" dmg2img -s ${recovery} $out chmod +w $out guestfish -a $out <