weechat-matrix-bridge: init at 2017-03-28

This commit is contained in:
Maximilian Bosch 2017-08-31 11:50:58 +02:00
parent f5dd3b71e8
commit 724a69f5c4
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
3 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,44 @@
{ stdenv, curl, fetchFromGitHub, cjson, olm, luaffi }:
stdenv.mkDerivation {
name = "weechat-matrix-bridge-2017-03-28";
src = fetchFromGitHub {
owner = "torhve";
repo = "weechat-matrix-protocol-script";
rev = "0052e7275ae149dc5241226391c9b1889ecc3c6b";
sha256 = "14x58jd44g08sfnp1gx74gq2na527v5jjpsvv1xx4b8mixwy20hi";
};
patches = [
./library-path.patch
];
buildInputs = [ curl cjson olm luaffi ];
postPatch = ''
substituteInPlace matrix.lua \
--replace "/usr/bin/curl" "${curl}/bin/curl" \
--replace "__NIX_LIB_PATH__" "$out/lib/?.so" \
--replace "__NIX_OLM_PATH__" "$out/share/?.lua"
substituteInPlace olm.lua \
--replace "__NIX_LIB_PATH__" "$out/lib/?.so"
'';
installPhase = ''
mkdir -p $out/{share,lib}
cp {matrix.lua,olm.lua} $out/share
cp ${cjson}/lib/lua/5.2/cjson.so $out/lib/cjson.so
cp ${olm}/lib/libolm.so $out/lib/libolm.so
cp ${luaffi}/lib/ffi.so $out/lib/ffi.so
'';
meta = with stdenv.lib; {
description = "A WeeChat script in Lua that implements the matrix.org chat protocol";
homepage = https://github.com/torhve/weechat-matrix-protocol-script;
maintainers = with maintainers; [ ma27 ];
license = licenses.mit; # see https://github.com/torhve/weechat-matrix-protocol-script/blob/0052e7275ae149dc5241226391c9b1889ecc3c6b/matrix.lua#L53
platforms = platforms.unix;
};
}

View File

@ -0,0 +1,28 @@
diff --git a/matrix.lua b/matrix.lua
index b79f500..32b37a2 100644
--- a/matrix.lua
+++ b/matrix.lua
@@ -43,6 +43,9 @@ This script maps this as follows:
]]
+package.cpath = package.cpath .. ";__NIX_LIB_PATH__"
+package.path = package.path .. ";__NIX_OLM_PATH__"
+
local json = require 'cjson' -- apt-get install lua-cjson
local olmstatus, olm = pcall(require, 'olm') -- LuaJIT olm FFI binding ln -s ~/olm/olm.lua /usr/local/share/lua/5.1
local w = weechat
diff --git a/olm.lua b/olm.lua
index 114649c..4828371 100644
--- a/olm.lua
+++ b/olm.lua
@@ -17,6 +17,9 @@
* limitations under the License.
*/
--]]
+
+package.cpath = package.cpath .. ";__NIX_LIB_PATH__"
+
local ffi = require'ffi'
ffi.cdef[[

View File

@ -16696,6 +16696,10 @@ with pkgs;
guile = guile_2_0;
};
weechat-matrix-bridge = callPackage ../applications/networking/instant-messengers/weechat-matrix-bridge {
inherit (luaPackages) cjson;
};
westonLite = callPackage ../applications/window-managers/weston {
pango = null;
freerdp = null;