at master 1.8 kB view raw
1{ pkgs, ... }: 2{ 3 name = "wmderland"; 4 meta = with pkgs.lib.maintainers; { 5 maintainers = [ takagiy ]; 6 }; 7 8 nodes.machine = 9 { lib, ... }: 10 { 11 imports = [ 12 ./common/x11.nix 13 ./common/user-account.nix 14 ]; 15 test-support.displayManager.auto.user = "alice"; 16 services.displayManager.defaultSession = lib.mkForce "none+wmderland"; 17 services.xserver.windowManager.wmderland.enable = true; 18 19 systemd.services.setupWmderlandConfig = { 20 wantedBy = [ "multi-user.target" ]; 21 before = [ "multi-user.target" ]; 22 environment = { 23 HOME = "/home/alice"; 24 }; 25 unitConfig = { 26 type = "oneshot"; 27 RemainAfterExit = true; 28 user = "alice"; 29 }; 30 script = 31 let 32 config = pkgs.writeText "config" '' 33 set $Mod = Mod1 34 bindsym $Mod+Return exec ${pkgs.xterm}/bin/xterm -cm -pc 35 ''; 36 in 37 '' 38 mkdir -p $HOME/.config/wmderland 39 cp ${config} $HOME/.config/wmderland/config 40 ''; 41 }; 42 }; 43 44 testScript = 45 { ... }: 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 we can open a new terminal"): 53 machine.send_key("alt-ret") 54 machine.wait_until_succeeds("pgrep xterm") 55 machine.wait_for_window(r"alice.*?machine") 56 machine.screenshot("terminal") 57 58 with subtest("ensure we can communicate through ipc with wmderlandc"): 59 # Kills the previously open xterm 60 machine.succeed("pgrep xterm") 61 machine.execute("DISPLAY=:0 wmderlandc kill") 62 machine.fail("pgrep xterm") 63 ''; 64}