1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 cairocffi,
6 dbus-fast,
7 glib,
8 iwlib,
9 libcst,
10 libdrm,
11 libinput,
12 libxkbcommon,
13 mpd2,
14 pango,
15 pixman,
16 pkg-config,
17 psutil,
18 pulsectl-asyncio,
19 pygobject3,
20 pytz,
21 pywayland,
22 pywlroots,
23 pyxdg,
24 setuptools,
25 setuptools-scm,
26 wayland,
27 wlroots,
28 xcbutilcursor,
29 xcbutilwm,
30 xcffib,
31 xkbcommon,
32 nixosTests,
33 extraPackages ? [ ],
34}:
35
36buildPythonPackage rec {
37 pname = "qtile";
38 version = "0.33.0";
39 pyproject = true;
40
41 src = fetchFromGitHub {
42 owner = "qtile";
43 repo = "qtile";
44 tag = "v${version}";
45 hash = "sha256-npteZR48xN3G5gDsHt8c67zzc8Tom1YxnxbnDuKZHVg=";
46 };
47
48 patches = [
49 ./fix-restart.patch # https://github.com/NixOS/nixpkgs/issues/139568
50 ];
51
52 postPatch = ''
53 substituteInPlace libqtile/pangocffi.py \
54 --replace-fail libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
55 --replace-fail libpangocairo-1.0.so.0 ${pango.out}/lib/libpangocairo-1.0.so.0 \
56 --replace-fail libpango-1.0.so.0 ${pango.out}/lib/libpango-1.0.so.0
57 substituteInPlace libqtile/backend/x11/xcursors.py \
58 --replace-fail libxcb-cursor.so.0 ${xcbutilcursor.out}/lib/libxcb-cursor.so.0
59 substituteInPlace libqtile/backend/wayland/cffi/build.py \
60 --replace-fail /usr/include/pixman-1 ${lib.getDev pixman}/include \
61 --replace-fail /usr/include/libdrm ${lib.getDev libdrm}/include/libdrm
62 '';
63
64 build-system = [
65 setuptools
66 setuptools-scm
67 pkg-config
68 ];
69
70 dependencies = extraPackages ++ [
71 (cairocffi.override { withXcffib = true; })
72 dbus-fast
73 iwlib
74 libcst
75 mpd2
76 psutil
77 pulsectl-asyncio
78 pygobject3
79 pytz
80 pywayland
81 pywlroots
82 pyxdg
83 xcffib
84 xkbcommon
85 ];
86
87 buildInputs = [
88 libinput
89 libxkbcommon
90 wayland
91 wlroots
92 xcbutilwm
93 ];
94
95 doCheck = false;
96 passthru = {
97 tests.qtile = nixosTests.qtile;
98 providedSessions = [ "qtile" ];
99 };
100
101 postInstall = ''
102 install resources/qtile.desktop -Dt $out/share/xsessions
103 install resources/qtile-wayland.desktop -Dt $out/share/wayland-sessions
104 '';
105
106 meta = with lib; {
107 homepage = "http://www.qtile.org/";
108 license = licenses.mit;
109 description = "Small, flexible, scriptable tiling window manager written in Python";
110 mainProgram = "qtile";
111 platforms = platforms.linux;
112 maintainers = with maintainers; [
113 arjan-s
114 sigmanificient
115 ];
116 };
117}