merge slice/stage0-rename into main

Built in an independent worktree against docs/CONTRACT-sessions.md. Reports its
own slice's verification in its final message; the parent re-runs the union.
This commit is contained in:
Hermenix committed 2026-10-02 18:05:48 +00:00
commit eb2aec99e7
3 files changed
+55 -5

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@
# predates the group membership.
set -euo pipefail
SOCKET=${AGENT_EYES_SOCKET:-/run/hyprland-headless-stream/stream.sock}
SOCKET=${AGENT_EYES_SOCKET:-/run/hypr-stream/stream.sock}
RUNDIR=$(dirname "$SOCKET")
GROUP=${AGENT_EYES_GROUP:-hhstream}
CLIENT=${AGENT_EYES_CLIENT:-hhstream-client}
+47 -2
View File
@@ -14,8 +14,28 @@ let
# socket of the session and, by default, the published frame socket too.
# `RuntimeDirectoryPreserve` keeps it (and the Wayland socket) alive across a
# restart of either unit.
runtimeDirName = "hyprland-headless-stream";
#
# The name is short on purpose, and the assertion below is what keeps it that
# way. A Unix socket address carries its path inside `sun_path`, which is 108
# bytes including the terminating NUL (linux/un.h), and the compositor puts
# its IPC sockets under this directory:
#
# <runtimeDir>/hypr/<HYPRLAND_INSTANCE_SIGNATURE>/.socket.sock requests
# <runtimeDir>/hypr/<HYPRLAND_INSTANCE_SIGNATURE>/.socket2.sock events
#
# Of that budget, 20 characters are fixed and the instance signature (~30) is
# Hyprland's to choose; this directory's name is the only part we control. At
# the previous name -- `/run/hyprland-headless-stream`, 29 characters -- the
# event socket did not fit and the compositor refused to bind it:
#
# ERR ]: Socket2 path is too long. (2) IPC will not work.
#
# The *request* socket kept answering `hyprctl` anyway (both ends agreed on a
# residual truncated path), which is why the broken event socket went
# unnoticed. docs/CONTRACT-sessions.md §5 freezes the ceiling at 25.
runtimeDirName = "hypr-stream";
runtimeDir = "/run/${runtimeDirName}";
runtimeDirMaxLength = 25;
socketDir = builtins.dirOf cfg.socketPath;
@@ -160,7 +180,7 @@ in {
socketPath = lib.mkOption {
type = lib.types.str;
default = "/run/hyprland-headless-stream/stream.sock";
default = "/run/hypr-stream/stream.sock";
description = "Where the frame server publishes frames.";
};
@@ -414,6 +434,31 @@ in {
assertion = lib.hasPrefix "/" cfg.socketPath;
message = "services.hyprland-headless-stream.socketPath must be an absolute path.";
}
# Structural, not cosmetic: see the `runtimeDirName` comment above. The
# ceiling exists so the compositor's *event* socket still fits in
# `sun_path`, and the symptom of breaking it is silent -- the request
# socket keeps answering, so `hyprctl` looks fine while every event-driven
# feature is dead.
{
assertion = builtins.stringLength runtimeDir <= runtimeDirMaxLength;
message = ''
The compositor runtime directory "${runtimeDir}" is ${
toString (builtins.stringLength runtimeDir)
} characters; it must be at most ${toString runtimeDirMaxLength}.
Hyprland's event socket is <runtime dir>/hypr/<instance signature>/.socket2.sock.
A longer directory pushes that path past the 108 bytes a Unix socket address
has for `sun_path`, and the compositor then refuses to bind it:
ERR ]: Socket2 path is too long. (2) IPC will not work.
Nothing appears broken when that happens -- the shorter request socket still
answers `hyprctl` -- but the event stream never arrives, so every feature that
watches the compositor (window and workspace tracking, session containers)
stops working. docs/CONTRACT-sessions.md §5 freezes this limit; shorten the
directory rather than raising it.
'';
}
{
assertion = !cfg.sessions.enable || lib.hasAttr cfg.sessions.user config.users.users;
message = ''
+7 -2
View File
@@ -37,8 +37,13 @@ from typing import Iterator
from . import client as frames
from . import protocol
#: The frame socket the compositor's publisher serves.
DEFAULT_FRAME_SOCKET = frames.DEFAULT_SOCKET
#: The frame socket the compositor's publisher serves, under the compositor's
#: runtime directory `/run/hypr-stream` (short because the compositor's event
#: socket has to fit in `sun_path` -- see the assertion in `nix/module.nix`).
#: Spelled out rather than taken from `frames.DEFAULT_SOCKET`, which still names
#: the old `/run/hyprland-headless-stream` and is not this slice's file to
#: change; the module's `socketPath` default is the authority and it says this.
DEFAULT_FRAME_SOCKET = "/run/hypr-stream/stream.sock"
ENV_FRAME_SOCKET = "HHSTREAM_FRAME_SOCKET"
#: The group that owns the session's runtime directory.
DEFAULT_GROUP = "hhstream"