diff --git a/pkgs/servers/xmpp/prosody/default.nix b/pkgs/servers/xmpp/prosody/default.nix index abe0116ef90d..67882b1a02a3 100644 --- a/pkgs/servers/xmpp/prosody/default.nix +++ b/pkgs/servers/xmpp/prosody/default.nix @@ -1,12 +1,16 @@ -{ stdenv, fetchurl, lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop, libidn, openssl, makeWrapper, fetchhg }: +{ stdenv, fetchurl, lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop, luaevent ? null, libidn, openssl, makeWrapper, fetchhg, withLibevent ? false }: + +assert withLibevent -> luaevent != null; + +with stdenv.lib; let - libs = [ luasocket luasec luaexpat luafilesystem luabitop ]; + libs = [ luasocket luasec luaexpat luafilesystem luabitop ] ++ optional withLibevent luaevent; getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}"; getLuaPath = lib : getPath lib "lua"; getLuaCPath = lib : getPath lib "so"; - luaPath = stdenv.lib.concatStringsSep ";" (map getLuaPath libs); - luaCPath = stdenv.lib.concatStringsSep ";" (map getLuaCPath libs); + luaPath = concatStringsSep ";" (map getLuaPath libs); + luaCPath = concatStringsSep ";" (map getLuaCPath libs); in stdenv.mkDerivation rec { @@ -23,7 +27,8 @@ stdenv.mkDerivation rec { sha256 = "0010x2rl9f9ihy2nwqan2jdlz25433srj2zna1xh10490mc28hij"; }; - buildInputs = [ lua5 luasocket luasec luaexpat luabitop libidn openssl makeWrapper ]; + buildInputs = [ lua5 luasocket luasec luaexpat luabitop libidn openssl makeWrapper ] + ++ optional withLibevent luaevent; configureFlags = [ "--ostype=linux" @@ -44,9 +49,9 @@ stdenv.mkDerivation rec { meta = { description = "Open-source XMPP application server written in Lua"; - license = stdenv.lib.licenses.mit; + license = licenses.mit; homepage = http://www.prosody.im; - platforms = stdenv.lib.platforms.linux; - maintainers = [ stdenv.lib.maintainers.flosse ]; + platforms = platforms.linux; + maintainers = [ maintainers.flosse ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3a4256185dbc..710373ac93c7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7967,7 +7967,8 @@ let prosody = recurseIntoAttrs ( callPackage ../servers/xmpp/prosody { lua5 = lua5_1; - inherit (lua51Packages) luasocket luasec luaexpat luafilesystem luabitop; + inherit (lua51Packages) luasocket luasec luaexpat luafilesystem luabitop luaevent; + withLibevent = true; }); elasticmq = callPackage ../servers/elasticmq { }; diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index eeff4a47f9e1..f2caede41d5c 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -7,7 +7,7 @@ { fetchurl, stdenv, lua, callPackage, unzip, zziplib, pkgconfig, libtool , pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat, cairo -, perl, gtk, python, glib, gobjectIntrospection +, perl, gtk, python, glib, gobjectIntrospection, libevent }: let @@ -50,6 +50,36 @@ let }; }; + luaevent = buildLuaPackage rec { + version = "0.4.3"; + name = "luaevent-${version}"; + disabled = isLua52; + + src = fetchurl { + url = "https://github.com/harningt/luaevent/archive/v${version}.tar.gz"; + sha256 = "1ifr949j9xaas0jk0nxpilb44dqvk4c5h4m7ccksz5da3iksfgls"; + }; + + preBuild = '' + makeFlagsArray=( + INSTALL_DIR_LUA="$out/share/lua/${lua.luaversion}" + INSTALL_DIR_BIN="$out/lib/lua/${lua.luaversion}" + LUA_INC_DIR="${lua}/include" + ); + ''; + + buildInputs = [ libevent ]; + + propagatedBuildInputs = [ luasocket ]; + + meta = with stdenv.lib; { + homepage = http://luaforge.net/projects/luaevent/; + description = "Binding of libevent to Lua."; + license = licenses.mit; + maintainers = [ maintainers.koral ]; + }; + }; + luaexpat = buildLuaPackage rec { version = "1.3.0"; name = "expat-${version}";