summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/skype/default.nix
blob: a1ec302a34811f64c77ab35056a7b9909d5b4513 (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
71
{ stdenv, fetchurl, libXv, libXi, libXrender, libXrandr, zlib, glib
, libXext, libX11, libXScrnSaver, libSM, qt4, libICE, freetype, fontconfig
, pulseaudio, lib, ... }:

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

stdenv.mkDerivation rec {
  name = "skype-4.3.0.37";

  src = fetchurl {
    url = "http://download.skype.com/linux/${name}.tar.bz2";
    sha256 = "0bc9kck99rcsqzxzw3j6vnw5byvr8c9wixrx609zp255g0wxr6cc";
  };

  buildInputs = [
    stdenv.glibc
    stdenv.cc.gcc
    libXv
    libXext
    libX11
    qt4
    libXScrnSaver
    libSM
    libICE
    libXi
    libXrender
    libXrandr
    pulseaudio
    freetype
    fontconfig
    zlib
    glib
  ];

  phases = "unpackPhase installPhase";

  installPhase = ''
    mkdir -p $out/{libexec/skype/,bin}
    cp -r * $out/libexec/skype/

    fullPath=
    for i in $nativeBuildInputs; do
      fullPath=$fullPath''${fullPath:+:}$i/lib
    done

    patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
        --set-rpath "$fullPath" $out/libexec/skype/skype

    cat > $out/bin/skype << EOF
    #!${stdenv.shell}
    export PULSE_LATENCY_MSEC=60  # workaround for pulseaudio glitches
    $out/libexec/skype/skype --resources=$out/libexec/skype "\$@"
    EOF

    chmod +x $out/bin/skype

    # Fixup desktop file
    substituteInPlace skype.desktop --replace \
      "Icon=skype.png" "Icon=$out/libexec/skype/icons/SkypeBlue_48x48.png"
    substituteInPlace skype.desktop --replace \
      "Terminal=0" "Terminal=false"
    mkdir -p $out/share/applications
    mv skype.desktop $out/share/applications
  '';

  meta = {
    description = "A proprietary voice-over-IP (VoIP) client";
    homepage = http://www.skype.com/;
    license = stdenv.lib.licenses.unfree;
  };
}