From 9200c874c54a477c6e5060f67de7dff3d56f5405 Mon Sep 17 00:00:00 2001 From: Gurjaka Date: Tue, 1 Jul 2025 12:36:58 +0400 Subject: [PATCH] nixosTests.{qtile,qtile-extras}: Seperate to distint tests --- nixos/tests/all-tests.nix | 3 +- .../{qtile => qtile-extras}/add-widget.patch | 0 .../tests/{qtile => qtile-extras}/config.nix | 7 ++- .../tests/{qtile => qtile-extras}/default.nix | 16 ++++--- nixos/tests/qtile.nix | 46 +++++++++++++++++++ .../python-modules/qtile-extras/default.nix | 4 +- 6 files changed, 66 insertions(+), 10 deletions(-) rename nixos/tests/{qtile => qtile-extras}/add-widget.patch (100%) rename nixos/tests/{qtile => qtile-extras}/config.nix (87%) rename nixos/tests/{qtile => qtile-extras}/default.nix (89%) create mode 100644 nixos/tests/qtile.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 76867b74b49d..99ddff4a4813 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1250,7 +1250,8 @@ in qgis = handleTest ./qgis.nix { package = pkgs.qgis; }; qgis-ltr = handleTest ./qgis.nix { package = pkgs.qgis-ltr; }; qownnotes = runTest ./qownnotes.nix; - qtile = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./qtile/default.nix; + qtile = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./qtile.nix; + qtile-extras = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./qtile-extras/default.nix; quake3 = runTest ./quake3.nix; quicktun = runTest ./quicktun.nix; quickwit = runTest ./quickwit.nix; diff --git a/nixos/tests/qtile/add-widget.patch b/nixos/tests/qtile-extras/add-widget.patch similarity index 100% rename from nixos/tests/qtile/add-widget.patch rename to nixos/tests/qtile-extras/add-widget.patch diff --git a/nixos/tests/qtile/config.nix b/nixos/tests/qtile-extras/config.nix similarity index 87% rename from nixos/tests/qtile/config.nix rename to nixos/tests/qtile-extras/config.nix index 2536b9e2a8ae..b3756b1fe449 100644 --- a/nixos/tests/qtile/config.nix +++ b/nixos/tests/qtile-extras/config.nix @@ -1,6 +1,9 @@ -{ stdenvNoCC, fetchurl }: +{ + stdenvNoCC, + fetchurl, +}: stdenvNoCC.mkDerivation { - name = "qtile-config"; + name = "qtile-extras-config"; version = "0.0.1"; src = fetchurl { diff --git a/nixos/tests/qtile/default.nix b/nixos/tests/qtile-extras/default.nix similarity index 89% rename from nixos/tests/qtile/default.nix rename to nixos/tests/qtile-extras/default.nix index edd2cb3409da..de2a17db1fbf 100644 --- a/nixos/tests/qtile/default.nix +++ b/nixos/tests/qtile-extras/default.nix @@ -1,18 +1,24 @@ { lib, ... }: { - name = "qtile"; + name = "qtile-extras"; meta = { - maintainers = with lib.maintainers; [ sigmanificient ]; + maintainers = with lib.maintainers; [ + sigmanificient + gurjaka + ]; }; nodes.machine = - { pkgs, lib, ... }: + { + pkgs, + lib, + ... + }: let # We create a custom Qtile configuration file that adds a widget from # qtile-extras to the bar. This ensure that the qtile-extras package # also works, and that extraPackages behave as expected. - config-deriv = pkgs.callPackage ./config.nix { }; in { @@ -43,10 +49,8 @@ machine.succeed("qtile --version") with subtest("ensure we can open a new terminal"): - machine.sleep(2) machine.send_key("meta_l-ret") machine.wait_for_window(r"alice.*?machine") - machine.sleep(2) machine.screenshot("terminal") ''; } diff --git a/nixos/tests/qtile.nix b/nixos/tests/qtile.nix new file mode 100644 index 000000000000..55c4a4769aa1 --- /dev/null +++ b/nixos/tests/qtile.nix @@ -0,0 +1,46 @@ +{ lib, ... }: +{ + name = "qtile"; + + meta = { + maintainers = with lib.maintainers; [ + sigmanificient + gurjaka + ]; + }; + + nodes.machine = + { + pkgs, + lib, + ... + }: + { + imports = [ + ./common/x11.nix + ./common/user-account.nix + ]; + test-support.displayManager.auto.user = "alice"; + + services.xserver.windowManager.qtile.enable = true; + + services.displayManager.defaultSession = lib.mkForce "qtile"; + + environment.systemPackages = [ pkgs.kitty ]; + }; + + 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("qtile --version") + + with subtest("ensure we can open a new terminal"): + machine.send_key("meta_l-ret") + machine.wait_for_window(r"alice.*?machine") + machine.screenshot("terminal") + ''; +} diff --git a/pkgs/development/python-modules/qtile-extras/default.nix b/pkgs/development/python-modules/qtile-extras/default.nix index 5162bb758304..2f99629d1164 100644 --- a/pkgs/development/python-modules/qtile-extras/default.nix +++ b/pkgs/development/python-modules/qtile-extras/default.nix @@ -17,8 +17,8 @@ requests, setuptools-scm, xorgserver, + nixosTests, }: - buildPythonPackage rec { pname = "qtile-extras"; version = "0.33.0"; @@ -86,6 +86,8 @@ buildPythonPackage rec { pythonImportsCheck = [ "qtile_extras" ]; + passthru.tests.qtile-extras = nixosTests.qtile-extras; + meta = with lib; { description = "Extra modules and widgets for the Qtile tiling window manager"; homepage = "https://github.com/elParaguayo/qtile-extras";