{ description = "Stream a headless Hyprland session to a persistent Unix socket"; # Matches the nixpkgs this was developed against; consumers can override with # inputs.nixpkgs.follows = "nixpkgs" and nothing breaks. inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; outputs = { self, nixpkgs, ... }: let systems = [ "x86_64-linux" "aarch64-linux" ]; forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (import nixpkgs { inherit system; })); # `checks` needs the system name as well as the package set, to reach # self.packages.; forAllSystems only hands over pkgs. forAllSystems' = f: nixpkgs.lib.genAttrs systems (system: f { inherit system; pkgs = import nixpkgs { inherit system; }; }); in { packages = forAllSystems (pkgs: rec { hhstream = pkgs.callPackage ./nix/package.nix {}; # The MCP server. Its own derivation, not another entry point on # `hhstream`: it depends on the `mcp` SDK and `hhstream` is stdlib-only by # policy (nix/mcp.nix says why at length). `packages.hhstream` therefore # keeps the closure it had, which is the property `checks.unit` and # `nix build .#hhstream` are expected to hold. hhstream-mcp = pkgs.callPackage ./nix/mcp.nix {inherit hhstream;}; default = hhstream; }); nixosModules = rec { hyprland-headless-stream = import ./nix/module.nix; default = hyprland-headless-stream; }; # Unit tests + the two VM integration tests. See checks/default.nix and # README.dev.md; the interface they assert is docs/CONTRACT.md. checks = forAllSystems' ({ pkgs, system }: import ./checks { inherit pkgs self system; }); devShells = forAllSystems (pkgs: let hhstream = pkgs.callPackage ./nix/package.nix {}; in { default = pkgs.mkShell { packages = with pkgs; [ python3 python3.pkgs.pytest git tmux jq hyprland grim ffmpeg # The client side of the contract (hhstream-client), so a shell can # read the stream without a `nix build` first. It also brings # pywayland and xkbcommon, which `tests/pointer` imports directly -- # `test_keymap.py` compiles a real `us` keymap rather than stubbing # one, because a stub cannot tell you that `é` is unmappable. hhstream # The MCP server, so `hhstream-mcp` can be run (and handed to an MCP # client) straight out of `nix develop`. (callPackage ./nix/mcp.nix {inherit hhstream;}) # The SDK itself, because `tests/unit/test_mcp_server.py` imports it # directly: the tool table is stdlib-only and testable without it, but # the wiring that turns the table into `mcp.types.Tool` objects is not, # and a suite that could skip that file would stop noticing a schema # the SDK rejects. python3.pkgs.mcp # `websocket-client` drives Chromium over the DevTools protocol, which # is how the demo types into the page and reads the result back. python3.pkgs.websocket-client # Something to *put on* the headless screen. Chromium is the only # browser here that both runs on Wayland and can be driven over the # DevTools protocol, which is how examples/agent-eyes-demo.py types # into a page. Kept in the dev shell rather than installed globally. chromium ]; shellHook = '' export PYTHONPATH="$PWD/src''${PYTHONPATH:+:$PYTHONPATH}" echo "hhstream dev shell -- python $(python3 --version 2>&1 | cut -d' ' -f2)" ''; }; }); formatter = forAllSystems (pkgs: pkgs.alejandra); }; }