1{ pkgs, lib, ... }:
2
3let
4 seatd-test = pkgs.writeShellApplication {
5 name = "seatd-client-pid";
6 text = ''
7 journalctl -u seatd --no-pager -b | while read -r line; do
8 case "$line" in
9 *"New client connected"*)
10 line="''${line##*pid: }"
11 pid="''${line%%,*}"
12 ;;
13 *"Opened client"*)
14 echo "$pid"
15 exit
16 esac
17 done;
18 '';
19 };
20in
21{
22 name = "seatd";
23 meta.maintainers = with lib.maintainers; [ sinanmohd ];
24
25 nodes.machine =
26 { ... }:
27 {
28 imports = [ ./common/user-account.nix ];
29 services.getty.autologinUser = "alice";
30 users.users.alice.extraGroups = [
31 "seat"
32 "wheel"
33 ];
34
35 fonts.enableDefaultPackages = true;
36 environment.systemPackages = with pkgs; [
37 dwl
38 foot
39 seatd-test
40 ];
41
42 programs.bash.loginShellInit = ''
43 [ "$(tty)" = "/dev/tty1" ] &&
44 dwl -s 'foot touch /tmp/foot_started'
45 '';
46
47 hardware.graphics.enable = true;
48 virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
49 services.seatd.enable = true;
50 };
51
52 testScript = ''
53 machine.wait_for_file("/tmp/foot_started")
54 machine.succeed("test $(seatd-client-pid) = $(pgrep dwl)")
55 '';
56}