Files
hyprland-headless-stream-pl…/flake.nix
T

60 lines
2.3 KiB
Nix

{
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.<system>; 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 {};
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: {
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.
(callPackage ./nix/package.nix { })
# 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);
};
}