1{ lib, stdenv
2, fetchurl
3, fetchpatch
4, meson
5, ninja
6, pkg-config
7, python3
8, gobject-introspection
9, gtk-doc
10, docbook_xsl
11, docbook_xml_dtd_412
12, glib
13, gupnp-igd
14, gst_all_1
15, gnutls
16, graphviz
17}:
18
19stdenv.mkDerivation rec {
20 pname = "libnice";
21 version = "0.1.21";
22
23 outputs = [ "bin" "out" "dev" ]
24 ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ "devdoc" ];
25
26 src = fetchurl {
27 url = "https://libnice.freedesktop.org/releases/${pname}-${version}.tar.gz";
28 hash = "sha256-cuc6Ks8g9ZCT4h1WAWBuQFhzUD6zXzRvpiHeI+mbOzk=";
29 };
30
31 patches = [
32 # Fix generating data
33 # Note: upstream is not willing to merge our fix
34 # https://gitlab.freedesktop.org/libnice/libnice/merge_requests/35#note_98871
35 (fetchpatch {
36 url = "https://gitlab.freedesktop.org/libnice/libnice/commit/d470c4bf4f2449f7842df26ca1ce1efb63452bc6.patch";
37 sha256 = "0z74vizf92flfw1m83p7yz824vfykmnm0xbnk748bnnyq186i6mg";
38 })
39 ];
40
41 nativeBuildInputs = [
42 meson
43 ninja
44 pkg-config
45 python3
46 gobject-introspection
47
48 # documentation
49 gtk-doc
50 docbook_xsl
51 docbook_xml_dtd_412
52 graphviz
53 ];
54
55 buildInputs = [
56 gst_all_1.gstreamer
57 gst_all_1.gst-plugins-base
58 gnutls
59 gupnp-igd
60 ];
61
62 propagatedBuildInputs = [
63 glib
64 ];
65
66 mesonFlags = [
67 "-Dgtk_doc=${if (stdenv.buildPlatform == stdenv.hostPlatform) then "enabled" else "disabled"}"
68 "-Dintrospection=${if (stdenv.buildPlatform == stdenv.hostPlatform) then "enabled" else "disabled"}"
69 "-Dexamples=disabled" # requires many dependencies and probably not useful for our users
70 ];
71
72 # Tests are flaky
73 # see https://github.com/NixOS/nixpkgs/pull/53293#issuecomment-453739295
74 doCheck = false;
75
76 meta = with lib; {
77 description = "GLib ICE implementation";
78 longDescription = ''
79 Libnice is an implementation of the IETF's Interactice Connectivity
80 Establishment (ICE) standard (RFC 5245) and the Session Traversal
81 Utilities for NAT (STUN) standard (RFC 5389).
82
83 It provides a GLib-based library, libnice and a Glib-free library,
84 libstun as well as GStreamer elements.'';
85 homepage = "https://libnice.freedesktop.org/";
86 platforms = platforms.unix;
87 license = with licenses; [ lgpl21 mpl11 ];
88 };
89}