awesome: use a luaEnv

This commit is contained in:
Matthieu Coudron 2021-09-12 00:00:03 +02:00
parent 823d0d835c
commit 03806dfee7

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, luaPackages, cairo, librsvg, cmake, imagemagick, pkg-config, gdk-pixbuf
{ lib, stdenv, fetchFromGitHub, lua, cairo, librsvg, cmake, imagemagick, pkg-config, gdk-pixbuf
, xorg, libstartup_notification, libxdg_basedir, libpthreadstubs
, xcb-util-cursor, makeWrapper, pango, gobject-introspection
, which, dbus, nettools, git, doxygen
@ -12,10 +12,11 @@
# needed for beautiful.gtk to work
assert gtk3Support -> gtk3 != null;
let
luaEnv = lua.withPackages(ps: [ ps.lgi ps.ldoc ]);
in
stdenv.mkDerivation rec {
lgi = luaPackages.lgi;
lua = luaPackages.lua;
ldoc = luaPackages.ldoc;
pname = "awesome";
version = "4.3";
@ -35,7 +36,6 @@ stdenv.mkDerivation rec {
xmlto docbook_xml_dtd_45
docbook_xsl findXMLCatalogs
asciidoctor
ldoc
];
outputs = [ "out" "doc" ];
@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
propagatedUserEnvPkgs = [ hicolor-icon-theme ];
buildInputs = [ cairo librsvg dbus gdk-pixbuf gobject-introspection
git lgi libpthreadstubs libstartup_notification
git luaEnv libpthreadstubs libstartup_notification
libxdg_basedir lua nettools pango xcb-util-cursor
xorg.libXau xorg.libXdmcp xorg.libxcb xorg.libxshmfence
xorg.xcbutil xorg.xcbutilimage xorg.xcbutilkeysyms
@ -55,14 +55,14 @@ stdenv.mkDerivation rec {
cmakeFlags = [
#"-DGENERATE_MANPAGES=ON"
"-DOVERRIDE_VERSION=${version}"
] ++ lib.optional luaPackages.isLuaJIT "-DLUA_LIBRARY=${lua}/lib/libluajit-5.1.so"
] ++ lib.optional lua.pkgs.isLuaJIT "-DLUA_LIBRARY=${lua}/lib/libluajit-5.1.so"
;
GI_TYPELIB_PATH = "${pango.out}/lib/girepository-1.0";
# LUA_CPATH and LUA_PATH are used only for *building*, see the --search flags
# below for how awesome finds the libraries it needs at runtime.
LUA_CPATH = "${lgi}/lib/lua/${lua.luaversion}/?.so";
LUA_PATH = "${lgi}/share/lua/${lua.luaversion}/?.lua;;";
LUA_CPATH = "${luaEnv}/lib/lua/${lua.luaversion}/?.so";
LUA_PATH = "${luaEnv}/share/lua/${lua.luaversion}/?.lua;;";
postInstall = ''
# Don't use wrapProgram or the wrapper will duplicate the --search
@ -70,8 +70,8 @@ stdenv.mkDerivation rec {
mv "$out/bin/awesome" "$out/bin/.awesome-wrapped"
makeWrapper "$out/bin/.awesome-wrapped" "$out/bin/awesome" \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
--add-flags '--search ${lgi}/lib/lua/${lua.luaversion}' \
--add-flags '--search ${lgi}/share/lua/${lua.luaversion}' \
--add-flags '--search ${luaEnv}/lib/lua/${lua.luaversion}' \
--add-flags '--search ${luaEnv}/share/lua/${lua.luaversion}' \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH"
wrapProgram $out/bin/awesome-client \