1{ lib, ... }:
2{
3 name = "qtile-extras";
4
5 meta = {
6 maintainers = with lib.maintainers; [
7 sigmanificient
8 gurjaka
9 ];
10 };
11
12 nodes.machine =
13 {
14 pkgs,
15 lib,
16 ...
17 }:
18 let
19 # We create a custom Qtile configuration file that adds a widget from
20 # qtile-extras to the bar. This ensure that the qtile-extras package
21 # also works, and that extraPackages behave as expected.
22 config-deriv = pkgs.callPackage ./config.nix { };
23 in
24 {
25 imports = [
26 ../common/x11.nix
27 ../common/user-account.nix
28 ];
29 test-support.displayManager.auto.user = "alice";
30
31 services.xserver.windowManager.qtile = {
32 enable = true;
33 configFile = "${config-deriv}/config.py";
34 extraPackages = ps: [ ps.qtile-extras ];
35 };
36
37 services.displayManager.defaultSession = lib.mkForce "qtile";
38
39 environment.systemPackages = [ pkgs.kitty ];
40 };
41
42 testScript = ''
43 from pathlib import Path
44
45 with subtest("ensure x starts"):
46 machine.wait_for_x()
47 machine.wait_for_file("/home/alice/.Xauthority")
48 machine.succeed("xauth merge ~alice/.Xauthority")
49
50 with subtest("ensure client is available"):
51 machine.succeed("qtile --version")
52
53 with subtest("Qtile signals that it is ready"):
54 qtile_logfile = Path("/home/alice/.local/share/qtile/qtile.log")
55
56 machine.succeed(f"mkdir -p {qtile_logfile.parent}")
57 machine.succeed(f"touch {qtile_logfile}")
58 machine.succeed(f"sh -c 'tail -f {qtile_logfile} | grep --line-buffered \'ready\' -m 1'")
59
60 with subtest("ensure we can open a new terminal"):
61 machine.send_key("meta_l-ret")
62 machine.wait_for_window(r"alice.*?machine")
63 machine.screenshot("terminal")
64 '';
65}