Files
hyprland-headless-stream-pl…/nix/package.nix
T
HermenixandClaude Opus 5 5f94833a76 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
2026-10-11 02:57:55 +00:00

66 lines
2.5 KiB
Nix

{
lib,
python3,
...
}:
python3.pkgs.buildPythonApplication {
pname = "hhstream";
version = "0.1.0";
pyproject = true;
src = ../.;
build-system = [ python3.pkgs.setuptools ];
# `hhstream-pointer` is a Wayland client, so it needs libwayland's
# marshalling; and it resolves keysym names against the XKB layout it
# uploads, so it needs xkbcommon.
#
# Neither protocol XML is a build input: both generated modules are vendored
# under src/hhstream_pointer/_protocol, so a checkout builds without a code
# generator. See that package's docstring for why, and
# hhstream_pointer._protocol.regenerate for how to refresh them -- including
# the note that virtual-keyboard-unstable-v1.xml is not in wayland-protocols
# or wlr-protocols in this nixpkgs and comes from pkgs.hyprland.src.
dependencies = [ python3.pkgs.pywayland python3.pkgs.xkbcommon ];
# Unit tests are wired up in the flake's `checks` so they can run without
# installing the package; see docs/CONTRACT.md.
doCheck = false;
# Cheap proof that the vendored protocols still bind against this pywayland:
# importing each runs the scanner-generated `_gen_c()` for its interfaces.
pythonImportsCheck = [
"hhstream_pointer.ops"
"hhstream_pointer.keymap"
"hhstream_pointer._protocol.wlr_virtual_pointer_unstable_v1"
"hhstream_pointer._protocol.virtual_keyboard_unstable_v1"
# The web app: importing the server pulls in the router, the publisher and
# the pages.
"hhstream_live.server"
];
# `pythonImportsCheck` only *imports*, and `hhstream_live.phrase` reads its
# wordlist lazily -- so a wheel that dropped `wordlist.txt` would sail past it
# and fail at the first `enable` instead. Read the list for real, against the
# installed tree, and mint a phrase so the generator and its validator are
# proven on the same words. `doCheck = false` (the suite runs in the flake's
# `checks`), so this is the only place the packaged data is exercised.
postFixup = ''
echo "checking the installed wordlist..."
PYTHONPATH="$out/${python3.sitePackages}:$PYTHONPATH" ${python3.interpreter} -c '
import hhstream_live.phrase as phrase
count = len(phrase.words())
assert count > 7000, f"wordlist has only {count} words; is wordlist.txt installed?"
assert phrase.validate(phrase.generate())
print(f"wordlist ok: {count} words, ~{phrase.entropy_bits():.1f} bits a phrase")
'
'';
meta = {
description = "Publish a headless Hyprland session's frames on a Unix socket";
license = lib.licenses.mit;
mainProgram = "hhstream-server";
};
}