summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/tkabber/default.nix
blob: 6d0036c39b35ad00cac3184743d801c83fe6807a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ stdenv, fetchurl, tcl, tk, tcllib, tcltls, tclgpg
, bwidget, cacert, makeWrapper, x11 }:

let
  tclLibraries = [ bwidget tcllib tcltls tclgpg ];

  getTclLibPath = p: "${p}/lib/${p.libPrefix}";

  tclLibPaths = stdenv.lib.concatStringsSep " "
    (map getTclLibPath tclLibraries);

in stdenv.mkDerivation rec {
  name = "tkabber-0.11.1";

  src = fetchurl {
    url = "http://files.jabber.ru/tkabber/tkabber-0.11.1.tar.gz";
    sha256 = "19xv555cm7a2gczdalf9srxm39hmsh0fbidhwxa74a89nqkbf4lv";
  };

  defaultTheme = "ocean-deep";

  patchPhase = ''
    substituteInPlace login.tcl --replace \
      "custom::defvar loginconf(sslcacertstore) \"\"" \
      "custom::defvar loginconf(sslcacertstore) \"${cacert}/etc/ca-bundle.crt\""

    sed -i '/^if.*load_default_xrdb/,/^}$/ {
        s@option readfile \(\[fullpath [^]]*\]\)@option readfile "'"$out/share/doc/tkabber/examples/xrdb/${defaultTheme}.xrdb"'"@
    }' tkabber.tcl
  '';

  configurePhase = ''
    mkdir -p $out/bin
    sed -e "s@/usr/local@$out@" -i Makefile
  '';

  postInstall = ''
    wrapProgram $out/bin/tkabber --set TCLLIBPATH '"${tclLibPaths}"'
  '';

  buildInputs = [ tcl tk x11 makeWrapper ] ++ tclLibraries;

  meta = {
    homepage = "http://tkabber.jabber.ru/";
    description = "A GUI client for the XMPP (Jabber) instant messaging protocol";
    license = stdenv.lib.licenses.gpl2;
  };
}