Implements the `config` side of the module surface in docs/CONTRACT.md: - `hhstream` user/group, and one private runtime directory shared by both units (RuntimeDirectory= with Preserve=yes, so the Wayland socket survives a restart of either side). - A rendered hyprland.conf (nix/hyprland-conf.nix): one `monitor =` line per `outputs` entry plus `extraConfig` verbatim, with the logo/splash, config autoreload, DPMS, cursor, animations, shadows and the update/donation and guiutils/XDG checks switched off -- none of them mean anything in a session with no seat, no input device and no user. Validated with `Hyprland --verify-config`. - `hyprland-headless.service`: Hyprland as the service user, Type=notify (it sends READY=1), Restart=always, and deliberately no WAYLAND_DISPLAY or DISPLAY in the environment so the compositor cannot pick a nested backend and falls back to headless. - `hyprland-headless-stream.service`: hhstream-server as the same user, After=/BindsTo= the compositor, Restart=always, with --socket/--fps/ --format/--capture-command on the command line. `outputs.*.scale` used `lib.types.positive`, which does not exist in nixpkgs and made the whole `outputs` option unreadable; it is now `lib.types.numbers.positive`. `package` gets its documented default (the flake's own build) via mkDefault on the config side, so the declared option surface is otherwise untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pS3JxTJZBufyBKwimwBxy
95 lines
2.9 KiB
Nix
95 lines
2.9 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 virtual outputs out left to right.
|
|
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
|
|
# creates the virtual outputs 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}"}''
|