nixosTests.{qtile,qtile-extras}: Seperate to distint tests (#421427)
This commit is contained in:
commit
f42553e54e
@ -1258,6 +1258,7 @@ in
|
||||
qgis-ltr = handleTest ./qgis.nix { package = pkgs.qgis-ltr; };
|
||||
qownnotes = runTest ./qownnotes.nix;
|
||||
qtile = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./qtile/default.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;
|
||||
|
||||
22
nixos/tests/qtile-extras/add-startup-hook.patch
Normal file
22
nixos/tests/qtile-extras/add-startup-hook.patch
Normal file
@ -0,0 +1,22 @@
|
||||
--- a/config.py 2025-08-03 00:37:13.058374602 +0200
|
||||
+++ b/config.py 2025-08-03 00:45:51.869382363 +0200
|
||||
@@ -24,10 +24,18 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
-from libqtile import bar, layout, qtile, widget
|
||||
+from libqtile import bar, layout, qtile, widget, hook
|
||||
from libqtile.config import Click, Drag, Group, Key, Match, Screen
|
||||
from libqtile.lazy import lazy
|
||||
from libqtile.utils import guess_terminal
|
||||
+from libqtile.log_utils import logger
|
||||
+
|
||||
+
|
||||
+@hook.subscribe.startup
|
||||
+def print_ready():
|
||||
+ logger.warning("ready!") # warning to make it always visible
|
||||
+
|
||||
+
|
||||
|
||||
mod = "mod4"
|
||||
terminal = guess_terminal()
|
||||
30
nixos/tests/qtile-extras/config.nix
Normal file
30
nixos/tests/qtile-extras/config.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
stdenvNoCC,
|
||||
fetchurl,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "qtile-extras-config";
|
||||
version = "0.0.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://raw.githubusercontent.com/qtile/qtile/v0.28.1/libqtile/resources/default_config.py";
|
||||
hash = "sha256-Y5W277CWVNSi4BdgEW/f7Px/MMjnN9W9TDqdOncVwPc=";
|
||||
};
|
||||
|
||||
prePatch = ''
|
||||
cp $src config.py
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./add-widget.patch
|
||||
./add-startup-hook.patch
|
||||
];
|
||||
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp config.py $out/config.py
|
||||
'';
|
||||
}
|
||||
65
nixos/tests/qtile-extras/default.nix
Normal file
65
nixos/tests/qtile-extras/default.nix
Normal file
@ -0,0 +1,65 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
name = "qtile-extras";
|
||||
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [
|
||||
sigmanificient
|
||||
gurjaka
|
||||
];
|
||||
};
|
||||
|
||||
nodes.machine =
|
||||
{
|
||||
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
|
||||
{
|
||||
imports = [
|
||||
../common/x11.nix
|
||||
../common/user-account.nix
|
||||
];
|
||||
test-support.displayManager.auto.user = "alice";
|
||||
|
||||
services.xserver.windowManager.qtile = {
|
||||
enable = true;
|
||||
configFile = "${config-deriv}/config.py";
|
||||
extraPackages = ps: [ ps.qtile-extras ];
|
||||
};
|
||||
|
||||
services.displayManager.defaultSession = lib.mkForce "qtile";
|
||||
|
||||
environment.systemPackages = [ pkgs.kitty ];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
from pathlib import Path
|
||||
|
||||
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("Qtile signals that it is ready"):
|
||||
qtile_logfile = Path("/home/alice/.local/share/qtile/qtile.log")
|
||||
|
||||
machine.succeed(f"mkdir -p {qtile_logfile.parent}")
|
||||
machine.succeed(f"touch {qtile_logfile}")
|
||||
machine.succeed(f"sh -c 'tail -f {qtile_logfile} | grep --line-buffered \'ready\' -m 1'")
|
||||
|
||||
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")
|
||||
'';
|
||||
}
|
||||
22
nixos/tests/qtile/add-startup-hook.patch
Normal file
22
nixos/tests/qtile/add-startup-hook.patch
Normal file
@ -0,0 +1,22 @@
|
||||
--- a/config.py 2025-08-03 00:37:13.058374602 +0200
|
||||
+++ b/config.py 2025-08-03 00:45:51.869382363 +0200
|
||||
@@ -24,10 +24,18 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
-from libqtile import bar, layout, qtile, widget
|
||||
+from libqtile import bar, layout, qtile, widget, hook
|
||||
from libqtile.config import Click, Drag, Group, Key, Match, Screen
|
||||
from libqtile.lazy import lazy
|
||||
from libqtile.utils import guess_terminal
|
||||
+from libqtile.log_utils import logger
|
||||
+
|
||||
+
|
||||
+@hook.subscribe.startup
|
||||
+def print_ready():
|
||||
+ logger.warning("ready!") # warning to make it always visible
|
||||
+
|
||||
+
|
||||
|
||||
mod = "mod4"
|
||||
terminal = guess_terminal()
|
||||
@ -1,6 +1,9 @@
|
||||
{ stdenvNoCC, fetchurl }:
|
||||
{
|
||||
stdenvNoCC,
|
||||
fetchurl,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "qtile-config";
|
||||
name = "qtile-extras-config";
|
||||
version = "0.0.1";
|
||||
|
||||
src = fetchurl {
|
||||
@ -12,7 +15,7 @@ stdenvNoCC.mkDerivation {
|
||||
cp $src config.py
|
||||
'';
|
||||
|
||||
patches = [ ./add-widget.patch ];
|
||||
patches = [ ./add-startup-hook.patch ];
|
||||
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
|
||||
@ -3,16 +3,22 @@
|
||||
name = "qtile";
|
||||
|
||||
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.
|
||||
|
||||
# We create a custom Qtile configuration file that adds a
|
||||
# startup hook to qtile. This ensure we can reproducibly check
|
||||
# when Qtile is truly ready to receive our inputs
|
||||
config-deriv = pkgs.callPackage ./config.nix { };
|
||||
in
|
||||
{
|
||||
@ -30,10 +36,15 @@
|
||||
|
||||
services.displayManager.defaultSession = lib.mkForce "qtile";
|
||||
|
||||
environment.systemPackages = [ pkgs.kitty ];
|
||||
environment.systemPackages = [
|
||||
pkgs.kitty
|
||||
pkgs.xorg.xwininfo
|
||||
];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
from pathlib import Path
|
||||
|
||||
with subtest("ensure x starts"):
|
||||
machine.wait_for_x()
|
||||
machine.wait_for_file("/home/alice/.Xauthority")
|
||||
@ -42,11 +53,16 @@
|
||||
with subtest("ensure client is available"):
|
||||
machine.succeed("qtile --version")
|
||||
|
||||
with subtest("Qtile signals that it is ready"):
|
||||
qtile_logfile = Path("/home/alice/.local/share/qtile/qtile.log")
|
||||
|
||||
machine.succeed(f"mkdir -p {qtile_logfile.parent}")
|
||||
machine.succeed(f"touch {qtile_logfile}")
|
||||
machine.succeed(f"sh -c 'tail -f {qtile_logfile} | grep --line-buffered \'ready\' -m 1'")
|
||||
|
||||
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")
|
||||
'';
|
||||
}
|
||||
|
||||
@ -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";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user