about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/instant-messengers/ring-daemon/default.nix
blob: 4a95debdfd1045229ee527307d9faa5810668281 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{ stdenv
, fetchgit
, which
, autoreconfHook
, pkgconfig
, automake
, libtool
, pjsip
, libyamlcpp
, alsaLib
, libpulseaudio
, libsamplerate
, libsndfile
, dbus
, dbus_cplusplus
, ffmpeg_3
, udev
, pcre
, gsm
, speex
, boost
, opendht
, msgpack
, gnutls
, zlib
, jsoncpp
, xorg
, libargon2
, cryptopp
, openssl
, perl
, python3
, libupnp
, speexdsp
, fetchFromGitHub
, cmake
, asio
}:

let
  myPython = python3.withPackages (ps: with ps; [
    pygobject3
    dbus-python
  ]);

  src = fetchgit {
    url = "https://gitlab.savoirfairelinux.com/ring/ring-daemon.git";
    rev = "006b8dc7be08fe9beb68709af71004e7bc1ceb5c";
    sha256 = "0ih9g0rismrhx6nqcy3jqfbcs166grg0shnfmrnmykl9h0xy8z47";
  };

  patchdir = "${src}/contrib/src";

  restbed = import ./restbed.nix {
    inherit stdenv fetchFromGitHub cmake asio openssl;
    patches = [
    "${patchdir}/restbed/CMakeLists.patch"
    "${patchdir}/restbed/strand.patch"
    "${patchdir}/restbed/uri_cpp.patch"
    "${patchdir}/restbed/dns-resolution-error.patch"
    "${patchdir}/restbed/string.patch"
    ];
  };

  pjsip' = stdenv.lib.overrideDerivation pjsip (old: {
    patches = [
      "${patchdir}/pjproject/gnutls.patch"
      ./notestsapps.patch # this one had to be modified
      "${patchdir}/pjproject/fix_base64.patch"
      "${patchdir}/pjproject/ipv6.patch"
      "${patchdir}/pjproject/ice_config.patch"
      "${patchdir}/pjproject/multiple_listeners.patch"
      "${patchdir}/pjproject/pj_ice_sess.patch"
      "${patchdir}/pjproject/fix_turn_fallback.patch"
      "${patchdir}/pjproject/fix_ioqueue_ipv6_sendto.patch"
      "${patchdir}/pjproject/add_dtls_transport.patch"
    ];
    CFLAGS = "-g -DPJ_ICE_MAX_CAND=256 -DPJ_ICE_MAX_CHECKS=150 -DPJ_ICE_COMP_BITS=2 -DPJ_ICE_MAX_STUN=3 -DPJSIP_MAX_PKT_LEN=8000";
  });
in
stdenv.mkDerivation {
  pname = "ring-daemon";
  version = "2017-07-11";

  inherit src;

  nativeBuildInputs = [
    which
    autoreconfHook
    automake
    libtool
    pkgconfig
  ];

  buildInputs = [
    pjsip'
    libyamlcpp
    alsaLib
    libpulseaudio
    libsamplerate
    libsndfile
    dbus
    dbus_cplusplus
    ffmpeg_3
    udev
    pcre
    gsm
    speex
    boost
    opendht
    msgpack
    gnutls
    zlib
    jsoncpp
    restbed
    xorg.libX11
    libargon2
    cryptopp
    openssl
    perl
    libupnp
    speexdsp
  ];

  postInstall = ''
    mkdir $out/bin
    ln -s $out/lib/ring/dring $out/bin/dring
    cp -R ./tools/dringctrl/ $out/
    substitute ./tools/dringctrl/dringctrl.py $out/dringctrl/dringctrl.py \
      --replace '#!/usr/bin/env python3' "#!${myPython}/bin/python3"
    chmod +x $out/dringctrl/dringctrl.py
    ln -s $out/dringctrl/dringctrl.py $out/bin/dringctrl.py
  '';

  meta = with stdenv.lib; {
    description = "A Voice-over-IP software phone";
    longDescription = ''
      As the SIP/audio daemon and the user interface are separate processes, it
      is easy to provide different user interfaces. GNU Ring comes with various
      graphical user interfaces and even scripts to control the daemon from the
      shell.
    '';
    homepage = "https://ring.cx";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ taeer olynch ];
    platforms = platforms.linux;
    # pjsip' fails to compile with the supplied patch set, see: https://hydra.nixos.org/build/68667921/nixlog/4
    broken = true;
  };
}