Skip to content

Commit

Permalink
wmderland: add tests and expose xsessions desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
takagiy committed Nov 13, 2020
1 parent 4b95b8d commit 3a6c74a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ in
virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {};
wasabibackend = handleTest ./wasabibackend.nix {};
wireguard = handleTest ./wireguard {};
wmderland = handleTest ./wmderland.nix {};
wordpress = handleTest ./wordpress.nix {};
xandikos = handleTest ./xandikos.nix {};
xautolock = handleTest ./xautolock.nix {};
Expand Down
54 changes: 54 additions & 0 deletions nixos/tests/wmderland.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import ./make-test-python.nix ({ pkgs, ...} : {
name = "wmderland";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ takagiy ];
};

machine = { lib, ... }: {
imports = [ ./common/x11.nix ./common/user-account.nix ];
test-support.displayManager.auto.user = "alice";
services.xserver.displayManager.defaultSession = lib.mkForce "none+wmderland";
services.xserver.windowManager.wmderland.enable = true;

systemd.services.setupWmderlandConfig = {
wantedBy = [ "multi-user.target" ];
before = [ "multi-user.target" ];
environment = {
HOME = "/home/alice";
};
unitConfig = {
type = "oneshot";
RemainAfterExit = true;
user = "alice";
};
script = let
config = pkgs.writeText "config" ''
set $Mod = Mod1
bindsym $Mod+Return exec ${pkgs.xterm}/bin/xterm -cm -pc
'';
in ''
mkdir -p $HOME/.config/wmderland
cp ${config} $HOME/.config/wmderland/config
'';
};
};

testScript = { ... }: ''
with subtest("ensure x starts"):
machine.wait_for_x()
machine.wait_for_file("/home/alice/.Xauthority")
machine.succeed("xauth merge ~alice/.Xauthority")
with subtest("ensure we can open a new terminal"):
machine.send_key("alt-ret")
machine.wait_until_succeeds("pgrep xterm")
machine.wait_for_window(r"alice.*?machine")
machine.screenshot("terminal")
with subtest("ensure we can communicate through ipc with wmderlandc"):
# Kills the previously open xterm
machine.succeed("pgrep xterm")
machine.execute("DISPLAY=:0 wmderlandc kill")
machine.fail("pgrep xterm")
'';
})
12 changes: 11 additions & 1 deletion pkgs/applications/window-managers/wmderland/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, libnotify, libX11, xorgproto }:
{ stdenv, fetchFromGitHub, cmake, libnotify, libX11, xorgproto, nixosTests }:

with stdenv.lib;

Expand Down Expand Up @@ -31,6 +31,16 @@ stdenv.mkDerivation {
xorgproto
];

postInstall = ''
install -Dm0644 -t $out/share/wmderland/contrib $src/example/config
install -Dm0644 -t $out/share/xsessions $src/example/wmderland.desktop
'';

passthru = {
tests.basic = nixosTests.wmderland;
providedSessions = [ "wmderland" ];
};

meta = {
description = "Modern and minimal X11 tiling window manager";
homepage = "https://github.com/aesophor/wmderland";
Expand Down

0 comments on commit 3a6c74a

Please sign in to comment.