1{ stdenv
2, lib
3, fetchFromGitHub
4, srcOnly
5, cmake
6, ninja
7, pkg-config
8, libnice
9, openssl
10, plog
11, srtp
12, usrsctp
13}:
14
15stdenv.mkDerivation rec {
16 pname = "libdatachannel";
17 version = "0.21.2";
18
19 src = fetchFromGitHub {
20 owner = "paullouisageneau";
21 repo = "libdatachannel";
22 rev = "v${version}";
23 hash = "sha256-3fax57oaJvOgbTDPCiiUdtsfAGhICfPkuMihawq06SA=";
24 };
25
26 outputs = [ "out" "dev" ];
27
28 strictDeps = true;
29 nativeBuildInputs = [
30 cmake
31 ninja
32 pkg-config
33 ];
34 buildInputs = [
35 libnice
36 openssl
37 srtp
38 usrsctp
39 plog
40 ];
41
42 cmakeFlags = [
43 "-DUSE_NICE=ON"
44 "-DPREFER_SYSTEM_LIB=ON"
45 "-DNO_EXAMPLES=ON"
46 ];
47
48 postFixup = ''
49 # Fix include path that will be incorrect due to the "dev" output
50 substituteInPlace "$dev/lib/cmake/LibDataChannel/LibDataChannelTargets.cmake" \
51 --replace "\''${_IMPORT_PREFIX}/include" "$dev/include"
52 '';
53
54 meta = with lib; {
55 description = "C/C++ WebRTC network library featuring Data Channels, Media Transport, and WebSockets";
56 homepage = "https://libdatachannel.org/";
57 license = with licenses; [ mpl20 ];
58 maintainers = with maintainers; [ erdnaxe ];
59 platforms = platforms.linux;
60 };
61}