1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 lua,
7 cairo,
8 librsvg,
9 cmake,
10 imagemagick,
11 pkg-config,
12 gdk-pixbuf,
13 xorg,
14 libstartup_notification,
15 libxdg_basedir,
16 libpthreadstubs,
17 xcb-util-cursor,
18 makeWrapper,
19 pango,
20 gobject-introspection,
21 which,
22 dbus,
23 net-tools,
24 git,
25 doxygen,
26 xmlto,
27 docbook_xml_dtd_45,
28 docbook_xsl,
29 findXMLCatalogs,
30 libxkbcommon,
31 xcbutilxrm,
32 hicolor-icon-theme,
33 asciidoctor,
34 fontsConf,
35 gtk3Support ? false,
36 gtk3 ? null,
37}:
38
39# needed for beautiful.gtk to work
40assert gtk3Support -> gtk3 != null;
41
42let
43 luaEnv = lua.withPackages (ps: [
44 ps.lgi
45 ps.ldoc
46 ]);
47in
48
49stdenv.mkDerivation rec {
50 pname = "awesome";
51 version = "4.3";
52
53 src = fetchFromGitHub {
54 owner = "awesomewm";
55 repo = "awesome";
56 rev = "v${version}";
57 sha256 = "1i7ajmgbsax4lzpgnmkyv35x8vxqi0j84a14k6zys4blx94m9yjf";
58 };
59
60 patches = [
61 # Pull upstream fix for -fno-common toolchain support:
62 # https://github.com/awesomeWM/awesome/pull/3065
63 (fetchpatch {
64 name = "fno-common-prerequisite.patch";
65 url = "https://github.com/awesomeWM/awesome/commit/c5202a48708585cc33528065af8d1b1d28b1a6e0.patch";
66 sha256 = "0sv36xf0ibjcm63gn9k3bl039sqavb2b5i6d65il4bdclkc0n08b";
67 })
68 (fetchpatch {
69 name = "fno-common.patch";
70 url = "https://github.com/awesomeWM/awesome/commit/d256d9055095f27a33696e0aeda4ee20ed4fb1a0.patch";
71 sha256 = "1n3y4wnjra8blss7642jgpxnm9n92zhhjj541bb9i60m4b7bgfzz";
72 })
73 ];
74
75 nativeBuildInputs = [
76 cmake
77 doxygen
78 imagemagick
79 makeWrapper
80 pkg-config
81 xmlto
82 docbook_xml_dtd_45
83 docbook_xsl
84 findXMLCatalogs
85 asciidoctor
86 gobject-introspection
87 ];
88
89 outputs = [
90 "out"
91 "doc"
92 ];
93
94 FONTCONFIG_FILE = toString fontsConf;
95
96 propagatedUserEnvPkgs = [ hicolor-icon-theme ];
97 buildInputs = [
98 cairo
99 librsvg
100 dbus
101 gdk-pixbuf
102 git
103 luaEnv
104 libpthreadstubs
105 libstartup_notification
106 libxdg_basedir
107 lua
108 net-tools
109 pango
110 xcb-util-cursor
111 xorg.libXau
112 xorg.libXdmcp
113 xorg.libxcb
114 xorg.libxshmfence
115 xorg.xcbutil
116 xorg.xcbutilimage
117 xorg.xcbutilkeysyms
118 xorg.xcbutilrenderutil
119 xorg.xcbutilwm
120 libxkbcommon
121 xcbutilxrm
122 ]
123 ++ lib.optional gtk3Support gtk3;
124
125 cmakeFlags = [
126 #"-DGENERATE_MANPAGES=ON"
127 "-DOVERRIDE_VERSION=${version}"
128 ]
129 ++ lib.optional lua.pkgs.isLuaJIT "-DLUA_LIBRARY=${lua}/lib/libluajit-5.1.so";
130
131 GI_TYPELIB_PATH = "${pango.out}/lib/girepository-1.0";
132 # LUA_CPATH and LUA_PATH are used only for *building*, see the --search flags
133 # below for how awesome finds the libraries it needs at runtime.
134 LUA_CPATH = "${luaEnv}/lib/lua/${lua.luaversion}/?.so";
135 LUA_PATH = "${luaEnv}/share/lua/${lua.luaversion}/?.lua;;";
136
137 postInstall = ''
138 # Don't use wrapProgram or the wrapper will duplicate the --search
139 # arguments every restart
140 mv "$out/bin/awesome" "$out/bin/.awesome-wrapped"
141 makeWrapper "$out/bin/.awesome-wrapped" "$out/bin/awesome" \
142 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
143 --add-flags '--search ${luaEnv}/lib/lua/${lua.luaversion}' \
144 --add-flags '--search ${luaEnv}/share/lua/${lua.luaversion}' \
145 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH"
146
147 wrapProgram $out/bin/awesome-client \
148 --prefix PATH : "${which}/bin"
149 '';
150
151 passthru = {
152 inherit lua;
153 };
154
155 meta = with lib; {
156 description = "Highly configurable, dynamic window manager for X";
157 homepage = "https://awesomewm.org/";
158 license = licenses.gpl2Plus;
159 maintainers = with maintainers; [
160 lovek323
161 rasendubi
162 ];
163 platforms = platforms.linux;
164 };
165}