at master 1.8 kB view raw
1{ lib, ... }: 2{ 3 name = "qtile"; 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 20 # startup hook to qtile. This ensure we can reproducibly check 21 # when Qtile is truly ready to receive our inputs 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 }; 35 36 services.displayManager.defaultSession = lib.mkForce "qtile"; 37 38 environment.systemPackages = [ 39 pkgs.kitty 40 pkgs.xorg.xwininfo 41 ]; 42 }; 43 44 testScript = '' 45 from pathlib import Path 46 47 with subtest("ensure x starts"): 48 machine.wait_for_x() 49 machine.wait_for_file("/home/alice/.Xauthority") 50 machine.succeed("xauth merge ~alice/.Xauthority") 51 52 with subtest("ensure client is available"): 53 machine.succeed("qtile --version") 54 55 with subtest("Qtile signals that it is ready"): 56 qtile_logfile = Path("/home/alice/.local/share/qtile/qtile.log") 57 58 machine.succeed(f"mkdir -p {qtile_logfile.parent}") 59 machine.succeed(f"touch {qtile_logfile}") 60 machine.succeed(f"sh -c 'tail -f {qtile_logfile} | grep --line-buffered \'ready\' -m 1'") 61 62 with subtest("ensure we can open a new terminal"): 63 machine.send_key("meta_l-ret") 64 machine.wait_for_window(r"alice.*?machine") 65 machine.screenshot("terminal") 66 ''; 67}