From a8efe614123e6be5ecd0661c9a9f07e9a6c57ec3 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Wed, 5 Sep 2018 17:01:45 +0200 Subject: 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 { }; 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. --- doc/package-notes.xml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'doc') diff --git a/doc/package-notes.xml b/doc/package-notes.xml index c2aef8937b060..1f088e8aaa0ea 100644 --- a/doc/package-notes.xml +++ b/doc/package-notes.xml @@ -671,6 +671,8 @@ overrides = super: self: rec { plugins = with availablePlugins; [ python perl ]; } } + If the configure function returns an attrset without the plugins + attribute, availablePlugins will be used automatically. @@ -704,6 +706,55 @@ overrides = super: self: rec { }; } + + WeeChat allows to set defaults on startup using the --run-command. + The configure method can be used to pass commands to the program: +weechat.override { + configure = { availablePlugins, ... }: { + init = '' + /set foo bar + /server add freenode chat.freenode.org + ''; + }; +} + Further values can be added to the list of commands when running + weechat --run-command "your-commands". + + + Additionally it's possible to specify scripts to be loaded when starting weechat. + These will be loaded before the commands from init: +weechat.override { + configure = { availablePlugins, ... }: { + scripts = with pkgs.weechatScripts; [ + weechat-xmpp weechat-matrix-bridge wee-slack + ]; + init = '' + /set plugins.var.python.jabber.key "val" + '': + }; +} + + + In nixpkgs there's a subpackage which contains derivations for + WeeChat scripts. Such derivations expect a passthru.scripts attribute + which contains a list of all scripts inside the store path. Furthermore all scripts + have to live in $out/share. An exemplary derivation looks like this: +{ stdenv, fetchurl }: + +stdenv.mkDerivation { + name = "exemplary-weechat-script"; + src = fetchurl { + url = "https://scripts.tld/your-scripts.tar.gz"; + sha256 = "..."; + }; + passthru.scripts = [ "foo.py" "bar.lua" ]; + installPhase = '' + mkdir $out/share + cp foo.py $out/share + cp bar.lua $out/share + ''; +} +
Citrix Receiver -- cgit 1.4.1