summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/hipchat/default.nix
blob: c7ea2d135d59d86c91468c34cd246b696877ba42 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{ stdenv, fetchurl, libtool, libXext, libSM, libICE, libX11, libXft, libXau, libXdmcp, libXrender
, libxcb, libXfixes, libXcomposite, libXi, dbus, freetype, fontconfig, openssl, zlib, mesa
, libxslt, libxml2
}:

assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"; 

let
  version = "2.1.982";

  rpath = stdenv.lib.makeSearchPath "lib" [
    stdenv.glibc
    stdenv.gcc.gcc
    libtool
    libXext
    libSM
    libICE
    libX11
    libXft
    libXau
    libXdmcp
    libXrender
    libxcb
    libXfixes
    libXcomposite
    libXi
    dbus
    freetype
    fontconfig
    openssl
    zlib
    mesa
    libxslt
    libxml2
  ];

  src = 
    if stdenv.system == "i686-linux" then fetchurl {
      url = "http://downloads.hipchat.com/linux/arch/i686/hipchat-${version}-i686.pkg.tar.xz";
      sha256 = "1i60fkl5hdx2p2yfsx9w8qkzn6hl8fajvfls0r0gc2bqc9whg6vn";
    } else fetchurl {
      url = "http://downloads.hipchat.com/linux/arch/x86_64/hipchat-${version}-x86_64.pkg.tar.xz";
      sha256 = "12bn4la9z1grkbcnixjwhadgxa2g6qkd5x7r3l3vn1sdalgal4ks";
    };

in stdenv.mkDerivation {
  name = "hipchat-${version}";

  buildCommand = ''
    tar xf ${src}
    mkdir -p $out
    mv opt/HipChat/lib $out
    mv opt/HipChat/bin $out
    mv usr/share $out
    patchShebangs $out/bin
    for file in $(find $out/lib -type f); do
        patchelf --set-interpreter $(cat $NIX_GCC/nix-support/dynamic-linker) $file || true
        patchelf --set-rpath ${rpath}:${stdenv.lib.optionalString stdenv.is64bit "${stdenv.gcc.gcc}/lib64:"}$out/lib $file || true
    done
    substituteInPlace $out/share/applications/hipchat.desktop \
      --replace /opt/HipChat/bin $out/bin
  '';

  meta = {
    description = "HipChat Desktop Client";
    homepage = http://www.hipchat.com;
    license = stdenv.lib.licenses.unfree;
    platforms = [ "i686-linux" "x86_64-linux" ];
  };
}