3
0
Fork 0
forked from mirrors/nixpkgs

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 let
cfg = config.services.xserver.windowManager.awesome; cfg = config.services.xserver.windowManager.awesome;
awesome = cfg.package;
in in
@ -14,9 +15,24 @@ in
options = { options = {
services.xserver.windowManager.awesome.enable = mkOption { services.xserver.windowManager.awesome = {
default = false;
description = "Enable the Awesome window manager."; 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"; { name = "awesome";
start = 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=$! waitPID=$!
''; '';
}; };
environment.systemPackages = [ pkgs.awesome ]; environment.systemPackages = [ awesome ];
}; };

View file

@ -47,4 +47,9 @@ stdenv.mkDerivation rec {
maintainers = with stdenv.lib.maintainers; [viric]; maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux; 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 , 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 , compton, procps, iproute, coreutils, curl, alsaUtils, findutils, rxvt_unicode
, which, dbus, nettools, git, asciidoc, doxygen, xmlto, docbook_xml_dtd_45 , which, dbus, nettools, git, asciidoc, doxygen, xmlto, docbook_xml_dtd_45
, docbook_xsl }: , docbook_xsl }:
let let
version = "3.5.5"; version = "3.5.5";
in in with luaPackages;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "awesome-${version}"; name = "awesome-${version}";
@ -32,6 +32,7 @@ stdenv.mkDerivation rec {
dbus dbus
doxygen doxygen
gdk_pixbuf gdk_pixbuf
gobjectIntrospection
git git
imagemagick imagemagick
lgi lgi
@ -60,18 +61,22 @@ stdenv.mkDerivation rec {
LD_LIBRARY_PATH = "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib"; LD_LIBRARY_PATH = "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib";
GI_TYPELIB_PATH = "${pango}/lib/girepository-1.0"; GI_TYPELIB_PATH = "${pango}/lib/girepository-1.0";
LUA_CPATH = "${lgi}/lib/lua/5.1/?.so"; LUA_CPATH = "${lgi}/lib/lua/${lua.luaversion}/?.so";
LUA_PATH = "${lgi}/share/lua/5.1/?.lua;${lgi}/share/lua/5.1/lgi/?.lua"; LUA_PATH = "${lgi}/share/lua/${lua.luaversion}/?.lua;${lgi}/share/lua/${lua.luaversion}/lgi/?.lua";
postInstall = '' postInstall = ''
wrapProgram $out/bin/awesome \ wrapProgram $out/bin/awesome \
--set LUA_CPATH '"${lgi}/lib/lua/5.1/?.so"' \ --prefix LUA_CPATH ";" '"${lgi}/lib/lua/${lua.luaversion}/?.so"' \
--set LUA_PATH '"${lgi}/share/lua/5.1/?.lua;${lgi}/share/lua/5.1/lgi/?.lua"' \ --prefix LUA_PATH ";" '"${lgi}/share/lua/${lua.luaversion}/?.lua;${lgi}/share/lua/${lua.luaversion}/lgi/?.lua"' \
--set GI_TYPELIB_PATH "${pango}/lib/girepository-1.0" \ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--prefix LD_LIBRARY_PATH : "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib" \ --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" --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 \ wrapProgram $out/bin/awesome-client \
--prefix PATH : "${which}/bin" --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; libpng = libpng12;
}; };
lgi = callPackage ../development/libraries/lgi { };
lib3ds = callPackage ../development/libraries/lib3ds { }; lib3ds = callPackage ../development/libraries/lib3ds { };
libaacs = callPackage ../development/libraries/libaacs { }; libaacs = callPackage ../development/libraries/libaacs { };

View file

@ -5,8 +5,9 @@
for each package in a separate file: the call to the function would for each package in a separate file: the call to the function would
be almost as must code as the function itself. */ be almost as must code as the function itself. */
{ fetchurl, stdenv, lua, callPackage, unzip, zziplib { fetchurl, stdenv, lua, callPackage, unzip, zziplib, pkgconfig, libtool
, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat , pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat, cairo
, perl, gtk, python, glib, gobjectIntrospection
}: }:
let let
@ -14,6 +15,7 @@ let
isLua52 = lua.luaversion == "5.2"; isLua52 = lua.luaversion == "5.2";
self = _self; self = _self;
_self = with self; { _self = with self; {
inherit lua;
inherit (stdenv.lib) maintainers; inherit (stdenv.lib) maintainers;
#define build lua package function #define build lua package function
@ -255,4 +257,31 @@ let
license = stdenv.lib.licenses.mit; 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 }; in self