nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 cairocffi,
7 dbus-fast,
8 aiohttp,
9 cairo,
10 cffi,
11 glib,
12 iwlib,
13 libcst,
14 libdrm,
15 libinput,
16 libxkbcommon,
17 mpd2,
18 pango,
19 pixman,
20 pkg-config,
21 psutil,
22 pulsectl-asyncio,
23 pygobject3,
24 pytz,
25 pyxdg,
26 setuptools,
27 setuptools-scm,
28 wayland,
29 wayland-protocols,
30 wayland-scanner,
31 wlroots,
32 xcbutilcursor,
33 xcbutilwm,
34 xcffib,
35 nixosTests,
36 extraPackages ? [ ],
37}:
38
39buildPythonPackage (finalAttrs: {
40 pname = "qtile";
41 version = "0.34.1";
42 # nixpkgs-update: no auto update
43 # should be updated alongside with `qtile-extras`
44
45 pyproject = true;
46
47 src = fetchFromGitHub {
48 owner = "qtile";
49 repo = "qtile";
50 tag = "v${finalAttrs.version}";
51 hash = "sha256-PPyI+IGvHBQusVmU3D26VjYjLaa9+94KUqNwbQSzeaI=";
52 };
53
54 patches = [
55 # The patch below makes upstream's build script search for wayland-scanner
56 # simply in $PATH, and not via `pkg-config`. This allows us to put
57 # wayland-scanner in nativeBuildInputs and keep using `strictDeps`. See:
58 #
59 # https://github.com/qtile/qtile/pull/5726
60 #
61 # Upstream has merged the PR directly - without creating a merge commit, so
62 # using a range is required.
63 (fetchpatch {
64 name = "qtile-PR5726-wayland-scanner-pkg-config.patch";
65 url = "https://github.com/qtile/qtile/compare/f0243abee5e6b94ef92b24e99d09037a4f40272b..553845bd17f38a6d1dee763a23c1b015df894794.patch";
66 hash = "sha256-hRArLC4nQMAbT//QhQeAUL1o7OCV0zvrlJztDavI0K0=";
67 })
68 ];
69
70 build-system = [
71 setuptools
72 setuptools-scm
73 ];
74 nativeBuildInputs = [
75 pkg-config
76 wayland-scanner
77 ];
78
79 env = {
80 "QTILE_CAIRO_PATH" = "${lib.getDev cairo}/include/cairo";
81 "QTILE_PIXMAN_PATH" = "${lib.getDev pixman}/include/pixman-1";
82 "QTILE_LIBDRM_PATH" = "${lib.getDev libdrm}/include/libdrm";
83 "QTILE_WLROOTS_PATH" =
84 "${lib.getDev wlroots}/include/wlroots-${lib.versions.majorMinor wlroots.version}";
85 };
86
87 pypaBuildFlags = [
88 "--config-setting=backend=wayland"
89 "--config-setting=GOBJECT=${lib.getLib glib}/lib/libgobject-2.0.so"
90 "--config-setting=PANGO=${lib.getLib pango}/lib/libpango-1.0.so"
91 "--config-setting=PANGOCAIRO=${lib.getLib pango}/lib/libpangocairo-1.0.so"
92 "--config-setting=XCBCURSOR=${lib.getLib xcbutilcursor}/lib/libxcb-cursor.so"
93 ];
94
95 dependencies = extraPackages ++ [
96 (cairocffi.override { withXcffib = true; })
97 dbus-fast
98 iwlib
99 libcst
100 mpd2
101 psutil
102 pulsectl-asyncio
103 pygobject3
104 pytz
105 pyxdg
106 xcffib
107 ];
108
109 buildInputs = [
110 cairo
111 libinput
112 libxkbcommon
113 wayland
114 wlroots
115 xcbutilwm
116 ];
117
118 propagatedBuildInputs = [
119 wayland-protocols
120 cffi
121 xcffib
122 aiohttp
123 ];
124
125 doCheck = false;
126 passthru = {
127 tests.qtile = nixosTests.qtile;
128 providedSessions = [ "qtile" ];
129 };
130
131 postInstall = ''
132 install resources/qtile.desktop -Dt $out/share/xsessions
133 install resources/qtile-wayland.desktop -Dt $out/share/wayland-sessions
134 '';
135
136 meta = {
137 homepage = "http://www.qtile.org/";
138 license = lib.licenses.mit;
139 description = "Small, flexible, scriptable tiling window manager written in Python";
140 mainProgram = "qtile";
141 platforms = lib.platforms.linux;
142 maintainers = with lib.maintainers; [
143 arjan-s
144 sigmanificient
145 doronbehar
146 ];
147 };
148})