Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions pkgs/development/libraries/libdatachannel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{ stdenv
, lib
, fetchFromGitHub
, srcOnly
, cmake
, ninja
, pkg-config
, libnice
, openssl
, plog
, srtp
, usrsctp
}:

let
# Use usrsctp version specified at https://github.com/paullouisageneau/libdatachannel/tree/master/deps
# Older or newer usrsctp might break libdatachannel, please keep it synced with upstream.
customUsrsctp = usrsctp.overrideAttrs (finalAttrs: previousAttrs: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more canonical name we would use would be usrsctp'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can revert this If you find it more then a slight annoyance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can open another PR if you say this is important.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just keep it in mind for next time or the next change to this file

version = "unstable-2021-10-08";
src = fetchFromGitHub {
owner = "sctplab";
repo = "usrsctp";
rev = "7c31bd35c79ba67084ce029511193a19ceb97447";
hash = "sha256-KeOR/0WDtG1rjUndwTUOhE21PoS+ETs1Vk7jQYy/vNs=";
};
});
in
stdenv.mkDerivation rec {
pname = "libdatachannel";
version = "0.18.5";

src = fetchFromGitHub {
owner = "paullouisageneau";
repo = pname;
rev = "v${version}";
hash = "sha256-ognjEDw68DpdQ/4JqcTejP5f9K0zLZGnpr99P/dvHK4=";
};

outputs = [ "out" "dev" ];

strictDeps = true;
nativeBuildInputs = [
cmake
ninja
pkg-config
];
buildInputs = [
libnice
openssl
srtp
];

cmakeFlags = [
"-DUSE_NICE=ON"
"-DUSE_SYSTEM_SRTP=ON"
"-DNO_EXAMPLES=ON"
];

postPatch = ''
# TODO: Remove when updating to 0.19.x, and add
# -DUSE_SYSTEM_USRSCTP=ON and -DUSE_SYSTEM_PLOG=ON to cmakeFlags instead
mkdir -p deps/{usrsctp,plog}
cp -r --no-preserve=mode ${srcOnly customUsrsctp}/. deps/usrsctp
cp -r --no-preserve=mode ${srcOnly plog}/. deps/plog
'';

postFixup = ''
# Fix shared library path that will be incorrect on move to "dev" output
substituteInPlace "$dev/lib/cmake/LibDataChannel/LibDataChannelTargets-release.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib" "$out/lib"
'';

meta = with lib; {
description = "C/C++ WebRTC network library featuring Data Channels, Media Transport, and WebSockets";
homepage = "https://libdatachannel.org/";
license = with licenses; [ mpl20 ];
maintainers = with maintainers; [ erdnaxe ];
platforms = platforms.linux;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27238,6 +27238,8 @@ with pkgs;

libcgroup = callPackage ../os-specific/linux/libcgroup { };

libdatachannel = callPackage ../development/libraries/libdatachannel { };

libkrun = callPackage ../development/libraries/libkrun {
inherit (darwin.apple_sdk.frameworks) Hypervisor;
};
Expand Down