Skip to content

Commit d6da32f

Browse files
authored
Merge pull request #316208 from Sigmanificient/qtile-nixosvm-tests-add-extra-packages
nixos/tests/qtile: test extraPackages and qtile-extras
2 parents 414be22 + 78b1309 commit d6da32f

File tree

4 files changed

+59
-5
lines changed

4 files changed

+59
-5
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ in {
827827
qgis = handleTest ./qgis.nix { qgisPackage = pkgs.qgis; };
828828
qgis-ltr = handleTest ./qgis.nix { qgisPackage = pkgs.qgis-ltr; };
829829
qownnotes = handleTest ./qownnotes.nix {};
830-
qtile = handleTestOn ["x86_64-linux" "aarch64-linux"] ./qtile.nix {};
830+
qtile = handleTestOn ["x86_64-linux" "aarch64-linux"] ./qtile/default.nix {};
831831
quake3 = handleTest ./quake3.nix {};
832832
quicktun = handleTest ./quicktun.nix {};
833833
quickwit = handleTest ./quickwit.nix {};

nixos/tests/qtile/add-widget.patch

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--- a/config.py 2024-05-31 14:49:23.852287845 +0200
2+
+++ b/config.py 2024-05-31 14:51:00.935182266 +0200
3+
@@ -29,6 +29,8 @@
4+
from libqtile.lazy import lazy
5+
from libqtile.utils import guess_terminal
6+
7+
+from qtile_extras import widget
8+
+
9+
mod = "mod4"
10+
terminal = guess_terminal()
11+
12+
@@ -162,6 +164,7 @@
13+
# NB Systray is incompatible with Wayland, consider using StatusNotifier instead
14+
# widget.StatusNotifier(),
15+
widget.Systray(),
16+
+ widget.AnalogueClock(),
17+
widget.Clock(format="%Y-%m-%d %a %I:%M %p"),
18+
widget.QuickExit(),
19+
],

nixos/tests/qtile/config.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{ stdenvNoCC, fetchurl }:
2+
stdenvNoCC.mkDerivation {
3+
name = "qtile-config";
4+
version = "0.0.1";
5+
6+
src = fetchurl {
7+
url = "https://raw.githubusercontent.com/qtile/qtile/v0.28.1/libqtile/resources/default_config.py";
8+
hash = "sha256-Y5W277CWVNSi4BdgEW/f7Px/MMjnN9W9TDqdOncVwPc=";
9+
};
10+
11+
prePatch = ''
12+
cp $src config.py
13+
'';
14+
15+
patches = [ ./add-widget.patch ];
16+
17+
dontUnpack = true;
18+
dontBuild = true;
19+
20+
installPhase = ''
21+
mkdir -p $out
22+
cp config.py $out/config.py
23+
'';
24+
}
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
import ./make-test-python.nix ({ lib, ...} : {
1+
import ../make-test-python.nix ({ lib, ...} : {
22
name = "qtile";
33

44
meta = {
55
maintainers = with lib.maintainers; [ sigmanificient ];
66
};
77

8-
nodes.machine = { pkgs, lib, ... }: {
9-
imports = [ ./common/x11.nix ./common/user-account.nix ];
8+
nodes.machine = { pkgs, lib, ... }: let
9+
# We create a custom Qtile configuration file that adds a widget from
10+
# qtile-extras to the bar. This ensure that the qtile-extras package
11+
# also works, and that extraPackages behave as expected.
12+
13+
config-deriv = pkgs.callPackage ./config.nix { };
14+
in {
15+
imports = [ ../common/x11.nix ../common/user-account.nix ];
1016
test-support.displayManager.auto.user = "alice";
1117

12-
services.xserver.windowManager.qtile.enable = true;
18+
services.xserver.windowManager.qtile = {
19+
enable = true;
20+
configFile = "${config-deriv}/config.py";
21+
extraPackages = ps: [ ps.qtile-extras ];
22+
};
23+
1324
services.displayManager.defaultSession = lib.mkForce "qtile";
1425

1526
environment.systemPackages = [ pkgs.kitty ];

0 commit comments

Comments
 (0)