about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/jami/daemon.nix
blob: 456ca85ed12c0f4d314a69377bc9e4b1d6ee0c18 (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
{ src
, version
, jami-meta
, stdenv
, lib
, autoreconfHook
, pkg-config
, perl # for pod2man
, ffmpeg
, pjsip
, alsa-lib
, asio
, dbus
, dbus_cplusplus
, fmt
, gmp
, libarchive
, libgit2
, libnatpmp
, secp256k1
, openssl
, opendht
, speex
, webrtc-audio-processing
, jsoncpp
, gnutls
, zlib
, libyamlcpp
, libpulseaudio
, jack
, udev
, libupnp
, msgpack
, restinio
, http-parser
}:

let
  readLinesToList = with builtins; file: filter (s: isString s && stringLength s > 0) (split "\n" (readFile file));

  ffmpeg-jami = ffmpeg.overrideAttrs (old:
    let
      patch-src = src + "/daemon/contrib/src/ffmpeg/";
    in
    {
      patches = old.patches ++ (map (x: patch-src + x) (readLinesToList ./config/ffmpeg_patches));
      configureFlags = old.configureFlags
        ++ (readLinesToList ./config/ffmpeg_args_common)
        ++ lib.optionals stdenv.isLinux (readLinesToList ./config/ffmpeg_args_linux)
        ++ lib.optionals (stdenv.isx86_32 || stdenv.isx86_64) (readLinesToList ./config/ffmpeg_args_x86);
      outputs = [ "out" "doc" ];
    });

  pjsip-jami = pjsip.overrideAttrs (old:
    let
      patch-src = src + "/daemon/contrib/src/pjproject/";
    in
    {
      patches = old.patches ++ (map (x: patch-src + x) (readLinesToList ./config/pjsip_patches));
    });

  opendht-jami = opendht.override {
    enableProxyServerAndClient = true;
    enablePushNotifications = true;
  };

in stdenv.mkDerivation {
  pname = "jami-daemon";
  inherit src version;
  sourceRoot = "source/daemon";

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    perl
  ];

  buildInputs = [
    alsa-lib
    asio
    dbus
    dbus_cplusplus
    fmt
    ffmpeg-jami
    gmp
    gnutls
    libarchive
    libgit2
    libnatpmp
    opendht-jami
    pjsip-jami
    secp256k1
    openssl
    speex
    webrtc-audio-processing
    zlib
    libyamlcpp
    jsoncpp
    libpulseaudio
    jack
    opendht
    libupnp
    udev
    msgpack
    restinio
    http-parser
  ];

  doCheck = false; # The tests fail to compile due to missing headers.

  enableParallelBuilding = true;

  passthru = {
    updateScript = ./update.sh;
    ffmpeg = ffmpeg-jami;
    pjsip = pjsip-jami;
    opendht = opendht-jami;
  };

  meta = jami-meta // {
    description = "The daemon" + jami-meta.description;
  };
}