Files
HermenixandClaude Opus 5 6510e315d4 module: make outputs monitor rules for real connectors, and own the seat flag
A machine running this module has a GPU. aquamarine's headless backend has
no allocator of its own -- `CHeadlessBackend::drmFD()` returns -1 and
`CBackend::start()` takes the allocator from the first backend with a drm fd
-- so the session always rides on the DRM backend and always has the host's
own connectors. `HEADLESS-1` is a name no connector will ever have, which
made the shipped default a monitor rule Hyprland silently ignored, and made
`vm-hyprland`'s assertion on that name unsatisfiable.

`outputs` now means "monitor rules applied to whatever outputs the machine
has". `name` is a regex against the real connector names and defaults to the
empty string -- Hyprland's own wildcard form, as in its shipped
`monitor=,preferred,auto,1` -- so `enable = true` alone gives a session at a
known size on any host. Nothing else about the option changed.

SEATD_VTBOUND=0 moves from checks/lib/gpu-session.nix into the compositor
unit, where it belongs: libseat finds no seatd socket and no logind session
for a system service, falls back to its embedded seatd, and that seat is
VT-bound by default -- so it opens /dev/tty0, which the service user cannot,
and every device open is refused. That is true on any host, not just in the
test. gpu-session.nix keeps only the two things that really are the test
machine's business: a render node and Mesa.

vm-hyprland now asserts over `hyprctl -j monitors` that at least one monitor
exists at the configured mode, with no monitor name anywhere in the check.
It also gains a wallpaper, because `--reject-blank` could not otherwise mean
anything: the session the module configures by default is a flat black
field, which grim captures as an all-zero 1280x720 RGBA PNG of exactly 3653
bytes -- `blank_png_size()` to the byte. Runs that passed that assertion were
reading Hyprland's startup notification overlay, which expires after about
fifteen seconds. With `misc:force_default_wallpaper` on, the frame is 85267
bytes with all 921600 pixels non-zero and is byte-identical at +15s, +30s and
+60s.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M5GEju6XhoRXDWvEiaAX2r
2026-09-28 21:51:24 +00:00

106 lines
3.5 KiB
Nix

# The hyprland.conf for a session nobody sits in front of.
#
# Split out of module.nix so the rendering is readable on its own (and diffable
# when an output list changes). Returns the file *text*; the caller puts it in
# the store.
{
lib,
outputs,
extraConfig,
}: let
# `monitor = <name>, <width>x<height>@<refresh>, auto, <scale>` -- "auto"
# lets the compositor lay the outputs out left to right.
#
# The name is a *rule selector*, not an output the compositor will create: it
# is matched as a regex against the names the backend hands up (`eDP-1`,
# `Virtual-1`, ...). Hyprland never invents an output to satisfy a rule, so a
# name that no connector has is a rule that is silently ignored.
#
# An empty name is the wildcard form -- the same shape as Hyprland's own
# shipped `monitor=,preferred,auto,1` -- and applies to every output the
# machine actually has. That is what a session which does not know the host's
# connector names wants, and it is the module's default.
monitorLine = o: "monitor = ${o.name}, ${toString o.width}x${toString o.height}@${toString o.refresh}, auto, ${toString o.scale}";
in ''
# Generated by services.hyprland-headless-stream. Do not edit.
#
# There is no seat, no libinput device, no cursor and no human here: the only
# consumer of this session is the frame server. Everything below either sets
# the mode of the outputs this machine has or switches off something that
# assumes a user.
${lib.concatMapStringsSep "\n" monitorLine outputs}
misc {
# Nothing should draw itself over the captured output.
disable_hyprland_logo = true
disable_splash_rendering = true
force_default_wallpaper = 0
background_color = 0x000000
# The config lives in the store and never changes under us; watching it
# would only cost inotify watches on a read-only path.
disable_autoreload = true
# A virtual output has no variable refresh rate to negotiate.
vrr = 0
# DPMS on a virtual output is meaningless, and there is no key or pointer
# event coming to wake it back up.
key_press_enables_dpms = false
mouse_move_enables_dpms = false
# Both of these check for a desktop that is not here: the Qt helper
# dialogs, and the XDG portal environment.
disable_hyprland_guiutils_check = true
disable_xdg_env_checks = true
}
debug {
# Capture wants a steady frame rate. With variable frame rate the
# compositor only renders on damage, so an idle session would starve the
# stream.
vfr = false
# The session is a systemd unit: its log belongs in the journal, not in a
# file under a runtime directory nobody will look in.
enable_stdout_logs = true
colored_stdout_logs = false
}
cursor {
# No hardware planes, no cursor theme on disk, nobody to warp.
invisible = true
no_hardware_cursors = true
enable_hyprcursor = false
no_warps = true
hide_on_key_press = false
inactive_timeout = 0
}
input {
# No pointer will ever exist; do not let focus depend on one.
follow_mouse = 0
}
# Frames cost capture bandwidth and CPU, and no one is watching the easing.
animations {
enabled = false
}
decoration {
blur {
enabled = false
}
shadow {
enabled = false
}
}
# Nothing here may reach the network or nag a user who is not there.
ecosystem {
no_update_news = true
no_donation_nag = true
}
${lib.optionalString (extraConfig != "") "\n${extraConfig}"}''