Weechat

From NixOS Wiki
Revision as of 19:42, 14 July 2018 by imported>Grahamc (document making otr work with weechat, sorry wiki maitainers, this is probably bad. :))

WeeChat is an extensible chat client with a command line interface.

Plugins

WeeChat can be extended with plugins, which can be written in a variety of scripting languages. As these plugins may depend on external libraries, we need to take care that those are found by WeeChat. For example the Jabber plugin depends on the xmpppy python library, which is provided in a separate nix package. To make WeeChat find the library, we can override the weechat nix package and add the dependency as an extra build input, e.g. by changing the ~/.nixpkgs/config.nix as follows:

{
  packageOverrides = pkgs: rec {
    weechat = pkgs.weechat.override { extraBuildInputs = [ pkgs.xmpppy ]; };
  };
}


Making the wechat-otr.py plugin work

You have to override potr to use an old, vulnerable version of pycrypto:

      (weechat.override {
        configure = { availablePlugins, ... }: {
          plugins = [
            (availablePlugins.python.withPackages (ps: [
              (ps.potr.overridePythonAttrs (oldAttrs:
                {
                  propagatedBuildInputs = [
                    (ps.buildPythonPackage rec {
                      name = "pycrypto-${version}";
                      version = "2.6.1";

                      src = pkgs.fetchurl {
                        url = "mirror://pypi/p/pycrypto/${name}.tar.gz";
                        sha256 = "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj";
                      };

                      patches = pkgs.stdenv.lib.singleton (pkgs.fetchpatch {
                        name = "CVE-2013-7459.patch";
                        url = "https://anonscm.debian.org/cgit/collab-maint/python-crypto.git"
                          + "/plain/debian/patches/CVE-2013-7459.patch?h=debian/2.6.1-7";
                        sha256 = "01r7aghnchc1bpxgdv58qyi2085gh34bxini973xhy3ks7fq3ir9";
                      });

                      buildInputs = [ pkgs.gmp ];

                      preConfigure = ''
                        sed -i 's,/usr/include,/no-such-dir,' configure
                        sed -i "s!,'/usr/include/'!!" setup.py
                      '';
                    })
                  ];
                }
              ))
            ]))
          ];
        };
      })