# What a NixOS test machine has to be given before Hyprland 0.56.2 will start. # # Imported by both VM checks. It is a machine definition, not a test: nothing # here relaxes anything either check asserts, it only supplies hardware and # session facts that a default `nodes.machine` does not have. # # The failure it fixes is the same one every time -- the compositor aborts with # # terminate called after throwing an instance of 'std::runtime_error' # what(): CBackend::create() failed! # # and systemd restarts it until the test's timeout expires. `CBackend::create()` # is aquamarine's, and reading aquamarine 0.15.1 rather than guessing at it, it # needs three separate things that a bare test machine does not provide. Each is # one of the blocks below, and each was confirmed in the guest by removing it # again and watching the compositor die on the next line down. # # A note for whoever hits this next: none of it is visible in the journal until # you also set `debug:disable_logs = false`, because Hyprland mutes aquamarine # by default and the abort is all that survives. That is how the three causes # below were separated. { ... }: { # 1. A DRM render node. # # `virtualisation.graphics = false` still leaves QEMU's default bochs-drm # adapter in the guest, which offers /dev/dri/card0 and *no* renderD*. Measured # in the guest, not assumed: # # (default) card0 (bochs-drm) # -vga virtio card0, renderD128 (virtio_gpu) # -device virtio-gpu-pci card0, card1, renderD128 (bochs + virtio) # -vga none -device virtio-gpu-pci card0, renderD128 (virtio_gpu) # # `-vga virtio` *replaces* the default adapter, so it is the one-option form of # the last line. `-device virtio-gpu-pci` on its own only *adds* a second card # next to bochs-drm, so it would need `-vga none` beside it to leave the guest # with a single DRM device. virtualisation.qemu.options = [ "-vga virtio" ]; # 2. Mesa, where the GBM loader looks for it. # # aquamarine's allocator is gbm_create_device() on that node. On NixOS the GBM # backends live under /run/opengl-driver, which only exists when # hardware.graphics is enabled -- a test machine has it off. Without it: # # MESA-LOADER: failed to open dri: /run/opengl-driver/lib/gbm/dri_gbm.so: # cannot open shared object file: No such file or directory # ERR from aquamarine ]: Couldn't open a GBM device at fd 21 # CRIT from aquamarine ]: Cannot open backend: no allocator available hardware.graphics.enable = true; # 3. A seat that is not bound to a VT. # # This one is not really the test machine's business, and it is flagged rather # than fixed: it belongs in nix/module.nix, which this slice may not edit. # # Only the DRM backend ever yields a buffer allocator -- # `CHeadlessBackend::drmFD()` returns -1 unconditionally (aquamarine # src/backend/Headless.cpp), and CBackend::start() takes the allocator from the # first implementation with a drm fd. So "headless" here does not mean "no # GPU": the headless backend still rides on the DRM backend's allocator, and if # the DRM backend fails there is none, whatever /dev/dri holds. # # The DRM backend opens /dev/dri/card0 through libseat. For this unit libseat # finds no /run/seatd.sock and no logind session (it is a system service, not a # login), so it falls back to its embedded seatd -- whose seat is VT-bound by # default. It then tries to open /dev/tty0, which the unprivileged `hhstream` # user cannot, so the client never becomes active and every device open is # refused: # # ERR ]: [libseat] [common/terminal.c:162] Could not open target tty: Permission denied # ERR ]: [libseat] [seatd/seat.c:557] Could not open VT for client # ERR ]: libseat: Couldn't open device at /dev/dri/card0 # ERR ]: drm: Skipping device /sys/devices/.../drm/card0, not a KMS device # ERR ]: drm: Found no gpus to use, cannot continue # ERR ]: DRM Backend failed # # SEATD_VTBOUND=0 (seatd/server.c) asks that embedded seatd for a seat with no # VT at all, which is the truth about this session: there is no terminal to # switch away from. A headless session run as a system user will need this on # any machine, not just in the test. systemd.services.hyprland-headless.environment.SEATD_VTBOUND = "0"; }