Merge origin/main into feat/keyboard-input: keep both the stream and the
keyboard sides
origin/main brought the session live-stream feature (stage 1): the
`hhstream_live` router, its phrase generator and wordlist, the
`sessions.stream.*` module options with their loopback-vs-openFirewall
assertion and the one firewall port, the `vm-stream-firewall` check, and
`tests/live/`. This branch adds keyboard input: the `key`/`type` ops, the
uploaded XKB keymap, `sessions.keyboard.{layout,model,variant,options}`
and the four `--xkb-*` flags on the driver unit, `vm-keyboard` and
`vm-keyboard-de`, and their docs.
The two features are independent, so every conflict wanted both sides.
Four files, resolved as follows.
checks/default.nix -- both the header list and the attribute set take all
three new checks: `vm-keyboard`, `vm-keyboard-de` (the same file with
`keyboardLayout = "de"`, because the layout reaches the keymap only
through the driver unit's argv) and `vm-stream-firewall`, which stays a
non-`sessionArgs` consumer with main's comment saying why. Neither side's
check list is reduced; the flake now exposes ten.
nix/package.nix -- one `pythonImportsCheck` list with both sides' entries:
`hhstream_pointer.keymap` and the vendored
`virtual_keyboard_unstable_v1` from here, `hhstream_live.server` from
main. The surrounding hunks were not in conflict, so the branch's
xkbcommon dependency and main's wordlist `postFixup` both survive, and
both ran in this merge's `checks.unit` build (`wordlist ok: 7772 words`).
nix/module.nix -- the sole conflict was textual: both sides open a new
sub-option block immediately after `sessions.pointer`. Both blocks are
kept, `keyboard` then `stream`, each with its own closing. Everything
else in the file merged cleanly, so `loopbackBinds`, the
openFirewall-on-loopback assertion and
`networking.firewall.allowedTCPPorts` are present alongside the driver
unit's `--xkb-layout`/`--xkb-model`/`--xkb-variant`/`--xkb-options`.
README.dev.md -- the `checks/` layout listing keeps both entries in the
file's existing order, `vm-keyboard.nix` then `vm-stream-firewall.nix`.
Verified: `nix flake check --no-build` evaluates every output green, and
`nix build .#checks.x86_64-linux.unit` passes -- 977 passed, 2 skipped,
0 failed, over both sides' suites. The VM checks were not run (they boot
a software-rendered compositor and must run one at a time).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PjpHyir6hxyjdw2o1RwQmn
This commit is contained in:
commit
5f94833a76
26 files changed
+10544
-13
No files matched your search
@@ -47,6 +47,11 @@ let
|
||||
controlSocket = "${brokerRuntimeDir}/control.sock";
|
||||
pointerSocket = "${brokerRuntimeDir}/pointer.sock";
|
||||
|
||||
# Addresses that mean "this listener answers on loopback only". The spelling
|
||||
# `localhost` is included because it is what a person writes; it is not a
|
||||
# resolution the module performs.
|
||||
loopbackBinds = [ "127.0.0.1" "::1" "localhost" ];
|
||||
|
||||
socketDir = builtins.dirOf cfg.socketPath;
|
||||
|
||||
# Hyprland refuses `--socket` unless it is paired with `--wayland-fd` (that
|
||||
@@ -694,6 +699,63 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
# The session-stream web app — `hhstream-live`, the router that serves a
|
||||
# live view of one session per phrase, over one port
|
||||
# (`docs/plans/2026-10-04-session-stream-webapp.md`).
|
||||
#
|
||||
# Only the *reach* of it is declared here so far: the port every stream
|
||||
# shares, the address it will bind, and whether that port is opened in
|
||||
# the firewall. The unit that runs the app, the phrases the broker keeps
|
||||
# in its records and the `session stream enable` verbs are later stages
|
||||
# of that plan — and deliberately so: a stream is switched on per
|
||||
# session, never for all of them, so nothing here turns one on.
|
||||
stream = {
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 9988;
|
||||
description = ''
|
||||
The single TCP port every stream shares.
|
||||
|
||||
One listener rather than one per session is what makes the phrase
|
||||
speakable: there is one address to give a person, one thing to
|
||||
firewall and one thing to stop. It is also why this is a fixed
|
||||
number with no range to fall back on — a stream at a port nobody
|
||||
was told about is worse than a stream that is down, so a taken port
|
||||
fails loudly instead of moving.
|
||||
'';
|
||||
};
|
||||
|
||||
bind = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1";
|
||||
description = ''
|
||||
The address the web app will bind.
|
||||
|
||||
Loopback by default, where the reachable path is an ssh tunnel
|
||||
(`ssh -L 9988:127.0.0.1:9988`) and nothing else. Set it to an
|
||||
address a peer can reach (`"0.0.0.0"`) when
|
||||
{option}`sessions.stream.openFirewall` is set: opening the port for
|
||||
a listener that is not on it is a hole with no service behind it,
|
||||
which is why that pairing is refused rather than allowed.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Open {option}`sessions.stream.port` in the firewall.
|
||||
|
||||
Off by default, and deliberately not implied by
|
||||
{option}`sessions.enable`: a live view of this desktop is readable
|
||||
by anyone who can reach the port, and the phrase in the URL is its
|
||||
only credential — no TLS, no second factor
|
||||
(`docs/plans/2026-10-04-…` §4). Opening it is an explicit act, and
|
||||
it opens exactly one port.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
stateDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/var/lib/hhstream";
|
||||
@@ -769,6 +831,21 @@ in {
|
||||
so without the broker it would bind a socket nothing connects to.
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
!cfg.sessions.stream.openFirewall
|
||||
|| !(lib.elem cfg.sessions.stream.bind loopbackBinds);
|
||||
message = ''
|
||||
services.hyprland-headless-stream.sessions.stream.openFirewall is true
|
||||
while sessions.stream.bind is "${cfg.sessions.stream.bind}" — a loopback
|
||||
address. The port would be open in the firewall with nothing answering on
|
||||
it from anywhere but this machine, which is a hole rather than a feature.
|
||||
|
||||
Set sessions.stream.bind to an address a peer can reach ("0.0.0.0"), or
|
||||
leave the firewall closed and reach the stream through a tunnel
|
||||
(`ssh -L 9988:127.0.0.1:9988`).
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = !cfg.sessions.enable || lib.hasAttr cfg.sessions.user config.users.users;
|
||||
message = ''
|
||||
@@ -831,6 +908,17 @@ in {
|
||||
})
|
||||
];
|
||||
|
||||
# The stream's one port, in the firewall.
|
||||
#
|
||||
# `lib.optional`, not a conditional block: the option is one line and its
|
||||
# effect is one port in the rule set, so there is nothing here that could
|
||||
# open a second one. Everything else about the app — the phrase per
|
||||
# session, the capture, the enable/disable verbs — is later stages of the
|
||||
# plan; this is the only part of the stream that a machine declares before
|
||||
# any of that exists.
|
||||
networking.firewall.allowedTCPPorts =
|
||||
lib.optional cfg.sessions.stream.openFirewall cfg.sessions.stream.port;
|
||||
|
||||
users.users.${cfg.user} = {
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
|
||||
Reference in new issue
Block a user