Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, cmake, libsodium, ncurses, libopus, msgpack
2, libvpx, check, libconfig, pkg-config }:
3
4let buildToxAV = !stdenv.isAarch32;
5in stdenv.mkDerivation rec {
6 pname = "libtoxcore";
7 version = "0.2.18";
8
9 src =
10 # We need the prepared sources tarball.
11 fetchurl {
12 url =
13 "https://github.com/TokTok/c-toxcore/releases/download/v${version}/c-toxcore-${version}.tar.gz";
14 sha256 = "sha256-8pQFN5mIY1k+KLxqa19W8JZ19s2KKDJre8MbSDbAiUI=";
15 };
16
17 cmakeFlags =
18 [ "-DBUILD_NTOX=ON" "-DDHT_BOOTSTRAP=ON" "-DBOOTSTRAP_DAEMON=ON" ]
19 ++ lib.optional buildToxAV "-DMUST_BUILD_TOXAV=ON";
20
21 buildInputs = [
22 libsodium msgpack ncurses libconfig
23 ] ++ lib.optionals buildToxAV [
24 libopus libvpx
25 ];
26
27 nativeBuildInputs = [ cmake pkg-config ];
28
29 doCheck = true;
30 nativeCheckInputs = [ check ];
31
32 postInstall = ''
33 substituteInPlace $out/lib/pkgconfig/toxcore.pc \
34 --replace '=''${prefix}/' '=' \
35
36 '';
37 # We might be getting the wrong pkg-config file anyway:
38 # https://github.com/TokTok/c-toxcore/issues/2334
39
40 meta = with lib; {
41 description = "P2P FOSS instant messaging application aimed to replace Skype";
42 homepage = "https://tox.chat";
43 license = licenses.gpl3Plus;
44 maintainers = with maintainers; [ peterhoeg ehmry ];
45 platforms = platforms.all;
46 };
47}