diff options
author | Farid Zakaria <fmzakari@google.com> | 2020-11-28 21:33:08 -0800 |
---|---|---|
committer | Farid Zakaria <fmzakari@google.com> | 2020-11-29 21:52:17 -0800 |
commit | aa7493063a58f67f13e48699ef279c814eab198a (patch) | |
tree | 0c0b7b8406688a7bb0ca32550c9b10385c7030ec /doc/builders | |
parent | 522d770b7a7b87185e9e6cae5cf596bdf1fe0114 (diff) |
doc: convert weechat docs to commonmark
This is essentially an automatic pandoc conversion of the weechat section in docbook as part of the larger CommonMark Docs project (https://github.com/NixOS/nixpkgs/projects/37) fixes #105264 Update doc/builders/packages/weechat.section.md Co-authored-by: Frederik Rietdijk <freddyrietdijk@fridh.nl> Update doc/builders/packages/weechat.section.md Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
Diffstat (limited to 'doc/builders')
-rw-r--r-- | doc/builders/packages/index.xml | 2 | ||||
-rw-r--r-- | doc/builders/packages/weechat.section.md | 85 | ||||
-rw-r--r-- | doc/builders/packages/weechat.xml | 85 |
3 files changed, 86 insertions, 86 deletions
diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index e20b0c689a805..f8be5aebcb51e 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -20,6 +20,6 @@ <xi:include href="steam.xml" /> <xi:include href="cataclysm-dda.section.xml" /> <xi:include href="urxvt.xml" /> - <xi:include href="weechat.xml" /> + <xi:include href="weechat.section.xml" /> <xi:include href="xorg.xml" /> </chapter> diff --git a/doc/builders/packages/weechat.section.md b/doc/builders/packages/weechat.section.md new file mode 100644 index 0000000000000..1d99b00e6323b --- /dev/null +++ b/doc/builders/packages/weechat.section.md @@ -0,0 +1,85 @@ +# Weechat {#sec-weechat} + +Weechat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration such as + +```nix +weechat.override {configure = {availablePlugins, ...}: { + plugins = with availablePlugins; [ python perl ]; + } +} +``` + +If the `configure` function returns an attrset without the `plugins` attribute, `availablePlugins` will be used automatically. + +The plugins currently available are `python`, `perl`, `ruby`, `guile`, `tcl` and `lua`. + +The python and perl plugins allows the addition of extra libraries. For instance, the `inotify.py` script in `weechat-scripts` requires D-Bus or libnotify, and the `fish.py` script requires `pycrypto`. To use these scripts, use the plugin's `withPackages` attribute: + +```nix +weechat.override { configure = {availablePlugins, ...}: { + plugins = with availablePlugins; [ + (python.withPackages (ps: with ps; [ pycrypto python-dbus ])) + ]; + }; +} +``` + +In order to also keep all default plugins installed, it is possible to use the following method: + +```nix +weechat.override { configure = { availablePlugins, ... }: { + plugins = builtins.attrValues (availablePlugins // { + python = availablePlugins.python.withPackages (ps: with ps; [ pycrypto python-dbus ]); + }); +}; } +``` + +WeeChat allows to set defaults on startup using the `--run-command`. The `configure` method can be used to pass commands to the program: + +```nix +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`: + +```nix +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: + +```nix +{ 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 + ''; +} +``` diff --git a/doc/builders/packages/weechat.xml b/doc/builders/packages/weechat.xml deleted file mode 100644 index a110d3f491c79..0000000000000 --- a/doc/builders/packages/weechat.xml +++ /dev/null @@ -1,85 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xml:id="sec-weechat"> - <title>Weechat</title> - - <para> - Weechat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration such as -<programlisting>weechat.override {configure = {availablePlugins, ...}: { - plugins = with availablePlugins; [ python perl ]; - } -}</programlisting> - If the <literal>configure</literal> function returns an attrset without the <literal>plugins</literal> attribute, <literal>availablePlugins</literal> will be used automatically. - </para> - - <para> - The plugins currently available are <literal>python</literal>, <literal>perl</literal>, <literal>ruby</literal>, <literal>guile</literal>, <literal>tcl</literal> and <literal>lua</literal>. - </para> - - <para> - The python and perl plugins allows the addition of extra libraries. For instance, the <literal>inotify.py</literal> script in weechat-scripts requires D-Bus or libnotify, and the <literal>fish.py</literal> script requires pycrypto. To use these scripts, use the plugin's <literal>withPackages</literal> attribute: -<programlisting>weechat.override { configure = {availablePlugins, ...}: { - plugins = with availablePlugins; [ - (python.withPackages (ps: with ps; [ pycrypto python-dbus ])) - ]; - }; -} -</programlisting> - </para> - - <para> - In order to also keep all default plugins installed, it is possible to use the following method: -<programlisting>weechat.override { configure = { availablePlugins, ... }: { - plugins = builtins.attrValues (availablePlugins // { - python = availablePlugins.python.withPackages (ps: with ps; [ pycrypto python-dbus ]); - }); -}; } -</programlisting> - </para> - - <para> - WeeChat allows to set defaults on startup using the <literal>--run-command</literal>. The <literal>configure</literal> method can be used to pass commands to the program: -<programlisting>weechat.override { - configure = { availablePlugins, ... }: { - init = '' - /set foo bar - /server add freenode chat.freenode.org - ''; - }; -}</programlisting> - Further values can be added to the list of commands when running <literal>weechat --run-command "your-commands"</literal>. - </para> - - <para> - Additionally it's possible to specify scripts to be loaded when starting <literal>weechat</literal>. These will be loaded before the commands from <literal>init</literal>: -<programlisting>weechat.override { - configure = { availablePlugins, ... }: { - scripts = with pkgs.weechatScripts; [ - weechat-xmpp weechat-matrix-bridge wee-slack - ]; - init = '' - /set plugins.var.python.jabber.key "val" - '': - }; -}</programlisting> - </para> - - <para> - In <literal>nixpkgs</literal> there's a subpackage which contains derivations for WeeChat scripts. Such derivations expect a <literal>passthru.scripts</literal> attribute which contains a list of all scripts inside the store path. Furthermore all scripts have to live in <literal>$out/share</literal>. An exemplary derivation looks like this: -<programlisting>{ 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 - ''; -}</programlisting> - </para> -</section> |