nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/library-path.patch
Maximilian Bosch a8efe61412
weechat: 2.1 -> 2.2; improve package configuration
This aims to make the `weechat` package even more configurable. It
allows to specify scripts and commands using the `configure` function
inside a `weechat.override` expression.

The package can be configured like this:

```
with import <nixpkgs> { };
weechat.override {
  plugins = { availablePlugins, ... }: {
    plugins = builtins.attrValues availablePlugins;

    init = ''
      /set foo bar
      /server add freenode chat.freenode.org
    '';

    scripts = [ "/path/to/script.py" ];
  };
}
```

All commands are passed to `weechat --run-command "/set foo bar;/server ..."`.

The `plugins' attribute is not necessarily required anymore, if it's
sufficient to add `init' commands, the `plugins' will be
`builtins.attrValues availablePlugins' by default.

Additionally the result contains `weechat` and `weechat-headless`
(introduced in WeeChat 2.1) now.
2018-09-07 13:10:43 +02:00

29 lines
715 B
Diff

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[[