nixos/tests/qtile: test extraPackages and qtile-extras

This commit is contained in:
Sigmanificient 2024-05-31 16:25:21 +02:00
parent 1085cdf835
commit 78b1309ad4
4 changed files with 59 additions and 5 deletions

View File

@ -827,7 +827,7 @@ in {
qgis = handleTest ./qgis.nix { qgisPackage = pkgs.qgis; };
qgis-ltr = handleTest ./qgis.nix { qgisPackage = pkgs.qgis-ltr; };
qownnotes = handleTest ./qownnotes.nix {};
qtile = handleTestOn ["x86_64-linux" "aarch64-linux"] ./qtile.nix {};
qtile = handleTestOn ["x86_64-linux" "aarch64-linux"] ./qtile/default.nix {};
quake3 = handleTest ./quake3.nix {};
quicktun = handleTest ./quicktun.nix {};
quickwit = handleTest ./quickwit.nix {};

View File

@ -0,0 +1,19 @@
--- a/config.py 2024-05-31 14:49:23.852287845 +0200
+++ b/config.py 2024-05-31 14:51:00.935182266 +0200
@@ -29,6 +29,8 @@
from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
+from qtile_extras import widget
+
mod = "mod4"
terminal = guess_terminal()
@@ -162,6 +164,7 @@
# NB Systray is incompatible with Wayland, consider using StatusNotifier instead
# widget.StatusNotifier(),
widget.Systray(),
+ widget.AnalogueClock(),
widget.Clock(format="%Y-%m-%d %a %I:%M %p"),
widget.QuickExit(),
],

View File

@ -0,0 +1,24 @@
{ stdenvNoCC, fetchurl }:
stdenvNoCC.mkDerivation {
name = "qtile-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 ];
dontUnpack = true;
dontBuild = true;
installPhase = ''
mkdir -p $out
cp config.py $out/config.py
'';
}

View File

@ -1,15 +1,26 @@
import ./make-test-python.nix ({ lib, ...} : {
import ../make-test-python.nix ({ lib, ...} : {
name = "qtile";
meta = {
maintainers = with lib.maintainers; [ sigmanificient ];
};
nodes.machine = { pkgs, lib, ... }: {
imports = [ ./common/x11.nix ./common/user-account.nix ];
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;
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 ];