Some lua and awesome improvements

- Move lgi to luaPackages
- Use luaPackages in awesome and passthru lua
- Allow to pass lua modules to the awesome WM so that those can be used in the configuration
This commit is contained in:
Luca Bruno 2014-12-17 15:03:25 +01:00
parent 374a9cc162
commit 614162ee6c
6 changed files with 75 additions and 41 deletions

View File

@ -5,6 +5,7 @@ with lib;
let
cfg = config.services.xserver.windowManager.awesome;
awesome = cfg.package;
in
@ -14,9 +15,24 @@ in
options = {
services.xserver.windowManager.awesome.enable = mkOption {
default = false;
description = "Enable the Awesome window manager.";
services.xserver.windowManager.awesome = {
enable = mkEnableOption "Awesome window manager";
luaModules = mkOption {
default = [];
type = types.listOf types.package;
description = "List of lua packages available for being used in the Awesome configuration.";
example = literalExample "[ luaPackages.oocairo ]";
};
package = mkOption {
default = null;
type = types.nullOr types.package;
description = "Package to use for running the Awesome WM.";
apply = pkg: if pkg == null then pkgs.awesome else pkg;
};
};
};
@ -30,12 +46,17 @@ in
{ name = "awesome";
start =
''
${pkgs.awesome}/bin/awesome &
${concatMapStrings (pkg: ''
export LUA_CPATH=$LUA_CPATH''${LUA_CPATH:+;}${pkg}/lib/lua/${awesome.lua.luaversion}/?.so
export LUA_PATH=$LUA_PATH''${LUA_PATH:+;}${pkg}/lib/lua/${awesome.lua.luaversion}/?.lua
'') cfg.luaModules}
${awesome}/bin/awesome &
waitPID=$!
'';
};
environment.systemPackages = [ pkgs.awesome ];
environment.systemPackages = [ awesome ];
};

View File

@ -47,4 +47,9 @@ stdenv.mkDerivation rec {
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
passthru = {
inherit lua;
};
}

View File

@ -1,13 +1,13 @@
{ stdenv, fetchurl, lua, cairo, cmake, imagemagick, pkgconfig, gdk_pixbuf
{ stdenv, fetchurl, luaPackages, cairo, cmake, imagemagick, pkgconfig, gdk_pixbuf
, xlibs, libstartup_notification, libxdg_basedir, libpthreadstubs
, xcb-util-cursor, lgi, makeWrapper, pango, gobjectIntrospection, unclutter
, xcb-util-cursor, makeWrapper, pango, gobjectIntrospection, unclutter
, compton, procps, iproute, coreutils, curl, alsaUtils, findutils, rxvt_unicode
, which, dbus, nettools, git, asciidoc, doxygen, xmlto, docbook_xml_dtd_45
, docbook_xsl }:
let
version = "3.5.5";
in
in with luaPackages;
stdenv.mkDerivation rec {
name = "awesome-${version}";
@ -32,6 +32,7 @@ stdenv.mkDerivation rec {
dbus
doxygen
gdk_pixbuf
gobjectIntrospection
git
imagemagick
lgi
@ -60,18 +61,22 @@ stdenv.mkDerivation rec {
LD_LIBRARY_PATH = "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib";
GI_TYPELIB_PATH = "${pango}/lib/girepository-1.0";
LUA_CPATH = "${lgi}/lib/lua/5.1/?.so";
LUA_PATH = "${lgi}/share/lua/5.1/?.lua;${lgi}/share/lua/5.1/lgi/?.lua";
LUA_CPATH = "${lgi}/lib/lua/${lua.luaversion}/?.so";
LUA_PATH = "${lgi}/share/lua/${lua.luaversion}/?.lua;${lgi}/share/lua/${lua.luaversion}/lgi/?.lua";
postInstall = ''
wrapProgram $out/bin/awesome \
--set LUA_CPATH '"${lgi}/lib/lua/5.1/?.so"' \
--set LUA_PATH '"${lgi}/share/lua/5.1/?.lua;${lgi}/share/lua/5.1/lgi/?.lua"' \
--set GI_TYPELIB_PATH "${pango}/lib/girepository-1.0" \
--prefix LUA_CPATH ";" '"${lgi}/lib/lua/${lua.luaversion}/?.so"' \
--prefix LUA_PATH ";" '"${lgi}/share/lua/${lua.luaversion}/?.lua;${lgi}/share/lua/${lua.luaversion}/lgi/?.lua"' \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--prefix LD_LIBRARY_PATH : "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib" \
--prefix PATH : "${compton}/bin:${unclutter}/bin:${procps}/bin:${iproute}/sbin:${coreutils}/bin:${curl}/bin:${alsaUtils}/bin:${findutils}/bin:${rxvt_unicode}/bin"
wrapProgram $out/bin/awesome-client \
--prefix PATH : "${which}/bin"
'';
passthru = {
inherit lua;
};
}

View File

@ -1,24 +0,0 @@
{ stdenv, fetchurl, pkgconfig, gobjectIntrospection, lua, glib }:
stdenv.mkDerivation {
name = "lgi-0.7.2";
src = fetchurl {
url = https://github.com/pavouk/lgi/archive/0.7.2.tar.gz;
sha256 = "0ihl7gg77b042vsfh0k7l53b7sl3d7mmrq8ns5lrsf71dzrr19bn";
};
meta = with stdenv.lib; {
description = "Gobject-introspection based dynamic Lua binding to GObject based libraries";
homepage = https://github.com/pavouk/lgi;
license = "custom";
maintainers = with maintainers; [ lovek323 ];
platforms = platforms.unix;
};
buildInputs = [ glib gobjectIntrospection lua pkgconfig ];
preBuild = ''
sed -i "s|/usr/local|$out|" lgi/Makefile
'';
}

View File

@ -5640,8 +5640,6 @@ let
libpng = libpng12;
};
lgi = callPackage ../development/libraries/lgi { };
lib3ds = callPackage ../development/libraries/lib3ds { };
libaacs = callPackage ../development/libraries/libaacs { };

View File

@ -5,8 +5,9 @@
for each package in a separate file: the call to the function would
be almost as must code as the function itself. */
{ fetchurl, stdenv, lua, callPackage, unzip, zziplib
, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat
{ fetchurl, stdenv, lua, callPackage, unzip, zziplib, pkgconfig, libtool
, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat, cairo
, perl, gtk, python, glib, gobjectIntrospection
}:
let
@ -14,6 +15,7 @@ let
isLua52 = lua.luaversion == "5.2";
self = _self;
_self = with self; {
inherit lua;
inherit (stdenv.lib) maintainers;
#define build lua package function
@ -255,4 +257,31 @@ let
license = stdenv.lib.licenses.mit;
};
};
lgi = stdenv.mkDerivation rec {
name = "lgi-${version}";
version = "0.7.2";
src = fetchurl {
url = "https://github.com/pavouk/lgi/archive/${version}.tar.gz";
sha256 = "0ihl7gg77b042vsfh0k7l53b7sl3d7mmrq8ns5lrsf71dzrr19bn";
};
meta = with stdenv.lib; {
description = "GObject-introspection based dynamic Lua binding to GObject based libraries";
homepage = https://github.com/pavouk/lgi;
license = "custom";
maintainers = with maintainers; [ lovek323 ];
platforms = platforms.unix;
};
buildInputs = [ glib gobjectIntrospection lua pkgconfig ];
makeFlags = [ "LUA_VERSION=${lua.luaversion}" ];
preBuild = ''
sed -i "s|/usr/local|$out|" lgi/Makefile
'';
};
}; in self