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