summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Marty <github@thibautmarty.fr>2020-11-27 19:20:36 +0000
committerThibaut Marty <github@thibautmarty.fr>2021-01-18 16:12:52 +0000
commita6cdb113bd5fa4d136593909456e310c3f457597 (patch)
tree32d83773ba0328dee5ad72263200846924e1b6ca
parentb1eb0af283167cdd0092f247d9d2db9c518789b8 (diff)
downloadnixpkgs-a6cdb113bd5fa4d136593909456e310c3f457597.tar
nixpkgs-a6cdb113bd5fa4d136593909456e310c3f457597.tar.gz
nixpkgs-a6cdb113bd5fa4d136593909456e310c3f457597.tar.bz2
nixpkgs-a6cdb113bd5fa4d136593909456e310c3f457597.tar.lz
nixpkgs-a6cdb113bd5fa4d136593909456e310c3f457597.tar.xz
nixpkgs-a6cdb113bd5fa4d136593909456e310c3f457597.tar.zst
nixpkgs-a6cdb113bd5fa4d136593909456e310c3f457597.zip
herbstluftwm: add NixOS test
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/herbstluftwm.nix38
-rw-r--r--pkgs/applications/window-managers/herbstluftwm/default.nix7
3 files changed, 45 insertions, 1 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 7d83b952f94..902c3bbc65e 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -147,6 +147,7 @@ in
   haproxy = handleTest ./haproxy.nix {};
   hardened = handleTest ./hardened.nix {};
   hedgedoc = handleTest ./hedgedoc.nix {};
+  herbstluftwm = handleTest ./herbstluftwm.nix {};
   installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
   oci-containers = handleTestOn ["x86_64-linux"] ./oci-containers.nix {};
   # 9pnet_virtio used to mount /nix partition doesn't support
diff --git a/nixos/tests/herbstluftwm.nix b/nixos/tests/herbstluftwm.nix
new file mode 100644
index 00000000000..2c98cceee6a
--- /dev/null
+++ b/nixos/tests/herbstluftwm.nix
@@ -0,0 +1,38 @@
+import ./make-test-python.nix ({ lib, ...} : {
+  name = "herbstluftwm";
+
+  meta = {
+    maintainers = with lib.maintainers; [ thibautmarty ];
+    timeout = 30;
+  };
+
+  machine = { pkgs, lib, ... }: {
+    imports = [ ./common/x11.nix ./common/user-account.nix ];
+    test-support.displayManager.auto.user = "alice";
+    services.xserver.displayManager.defaultSession = lib.mkForce "none+herbstluftwm";
+    services.xserver.windowManager.herbstluftwm.enable = true;
+    environment.systemPackages = [ pkgs.dzen2 ]; # needed for upstream provided panel
+  };
+
+  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 client is available"):
+        machine.succeed("herbstclient --version")
+
+    with subtest("ensure keybindings are set"):
+        machine.wait_until_succeeds("herbstclient list_keybinds | grep xterm")
+
+    with subtest("ensure panel starts"):
+        machine.wait_for_window("dzen title")
+
+    with subtest("ensure we can open a new terminal"):
+        machine.send_key("alt-ret")
+        machine.wait_for_window(r"alice.*?machine")
+        machine.sleep(2)
+        machine.screenshot("terminal")
+  '';
+})
diff --git a/pkgs/applications/window-managers/herbstluftwm/default.nix b/pkgs/applications/window-managers/herbstluftwm/default.nix
index 116a17bc0ee..1ec1e2e995c 100644
--- a/pkgs/applications/window-managers/herbstluftwm/default.nix
+++ b/pkgs/applications/window-managers/herbstluftwm/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, fetchurl, cmake, pkgconfig, python3, libX11, libXext, libXinerama, libXrandr, asciidoc
-, xdotool, xorgserver, xsetroot, xterm, runtimeShell }:
+, xdotool, xorgserver, xsetroot, xterm, runtimeShell
+, nixosTests }:
 
 # Doc generation is disabled by default when cross compiling because asciidoc
 # dependency is broken when cross compiling for now
@@ -75,6 +76,10 @@ in stdenv.mkDerivation rec {
 
   pytestFlagsArray = [ "../tests" ];
 
+  passthru = {
+    tests.herbstluftwm = nixosTests.herbstluftwm;
+  };
+
   meta = with lib; {
     description = "A manual tiling window manager for X";
     homepage = "https://herbstluftwm.org/";