summaryrefslogtreecommitdiffstats
path: root/nixos/tests/dwl.nix
blob: b46c0f98ee9719f14cf0688202c8678a4869fa70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ lib, ... }:
{
  name = "dwl_test_vm";

  meta = {
    maintainers = with lib.maintainers; [ gurjaka ];
  };

  nodes.machine =
    {
      pkgs,
      lib,
      ...
    }:
    {
      imports = [
        ./common/user-account.nix
        ./common/wayland-cage.nix
      ];

      environment.systemPackages = [ pkgs.foot ];

      services.displayManager.defaultSession = lib.mkForce "dwl";

      programs.dwl.enable = true;

      # Need to switch to a different GPU driver than the default one (-vga std) so that dwl works on aarch64-linux
      virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
    };

  testScript = ''
    with subtest("ensure dwl starts"):
      machine.wait_for_file("/run/user/1000/wayland-0")

    with subtest("ensure foot is installed"):
      machine.succeed("which foot")

    with subtest("ensure we can open a new terminal"):
      # sleep 3 is required to make sure dwl has started
      # TODO: find better way to identify dwl session
      machine.sleep(3)
      machine.send_key("alt-shift-ret")
      machine.sleep(3)
      machine.screenshot("terminal")
  '';
}