Files
komorebi/nix/dev/plasma-utm.nix
T
LGUG2Z 8b9cde08d0 build(nix): Plasma guests to develop against
The VM tests boot a machine, run a scenario and power it off. Trying a change by
hand needs a Plasma session that stays up, and on a Mac, one that renders on its
GPU.

nix/dev/plasma-vm.nix is a guest for QEMU on an Apple silicon Mac, headless or
with a Plasma session that logs in by itself, and nix/dev/plasma-utm.nix is that
session as a disk image for UTM, whose QEMU renders on the Mac's GPU. They are
nixosConfigurations of the flake, and install komorebi with services.komorebi
from the flake's packages. They carry no key, password or configuration of
anyone's: the console logs in by itself, ssh takes the keys a user puts in the
guest, and the RDP password is a file in the guest. plasma-guests-eval evaluates
the three on every system.

nix/dev/krdp.nix runs KRDP in the session, and the slow suite vm-rdp runs the
same unit in the session node: it waits for a password and listens once it has
one, FreeRDP's client is let in with the password and not with another, and the
picture the client gets on an X server of its own is the display. FreeRDP
decodes KRDP's H.264 with OpenH264 and shows nothing, so the guests' client is
built without it and decodes with FFmpeg. Keys over RDP stay unverified, since
no client can script them against KRDP; PLATFORM.md says so and what the suite
checks.

docs/dev/utm.md says how to build and run the guests, and what a builder has to
be.
2026-10-28 07:39:49 -07:00

58 lines
1.7 KiB
Nix

{ lib, pkgs, ... }:
# The Plasma session guest as a plain disk image, for a hypervisor with a GPU: UTM on Apple Silicon
# runs QEMU with virtio-gpu-gl (virgl over ANGLE/CoreGL), which the QEMU in nixpkgs, and so the
# 9p-booted `plasma-vm-session`, cannot: that one composites with llvmpipe on the CPU.
#
# This is the same session as plasma-vm.nix (komorebi from the module, KRDP), booted from its own
# disk by UEFI instead of from a kernel and the host's /nix/store. docs/dev/utm.md says how to
# install it onto a disk image and point UTM at it.
{
imports = [ ./plasma-vm.nix ];
komorebi.plasmaVm.session = true;
networking.hostName = lib.mkOverride 40 "plasma-utm";
boot.loader = {
grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};
efi.canTouchEfiVariables = false;
timeout = 1;
};
boot.initrd.availableKernelModules = [
"virtio_pci"
"virtio_blk"
"virtio_net"
"virtio_scsi"
"xhci_pci"
"usbhid"
];
# kms from the start, so that sddm has a screen to start on
boot.initrd.kernelModules = [ "virtio_gpu" ];
boot.kernelParams = [ "console=tty0" ];
boot.growPartition = true;
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
# the window follows the guest's resolution, and the clipboard is shared
services.spice-vdagentd.enable = true;
services.qemuGuest.enable = true;
# to check that the session really is on the GPU: `eglinfo | grep -i renderer` says virgl
environment.systemPackages = [ pkgs.mesa-demos ];
}