Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 scons,
6 ragel,
7 gengetopt,
8 pkg-config,
9 libuv,
10 openfecSupport ? true,
11 openfec,
12 speexdsp,
13 libunwindSupport ? lib.meta.availableOn stdenv.hostPlatform libunwind,
14 libunwind,
15 pulseaudioSupport ? true,
16 libpulseaudio,
17 opensslSupport ? true,
18 openssl,
19 soxSupport ? true,
20 sox,
21 libsndfileSupport ? true,
22 libsndfile,
23}:
24
25stdenv.mkDerivation rec {
26 pname = "roc-toolkit";
27 version = "0.4.0";
28
29 outputs = [
30 "out"
31 "dev"
32 ];
33
34 src = fetchFromGitHub {
35 owner = "roc-streaming";
36 repo = "roc-toolkit";
37 rev = "v${version}";
38 hash = "sha256-53irDq803dTg0YqtC1SOXmYNGypSMAEK+9HJ65pR5PA=";
39 };
40
41 nativeBuildInputs = [
42 scons
43 ragel
44 gengetopt
45 pkg-config
46 ];
47
48 propagatedBuildInputs = [
49 libuv
50 speexdsp
51 ]
52 ++ lib.optional openfecSupport openfec
53 ++ lib.optional libunwindSupport libunwind
54 ++ lib.optional pulseaudioSupport libpulseaudio
55 ++ lib.optional opensslSupport openssl
56 ++ lib.optional soxSupport sox
57 ++ lib.optional libsndfileSupport libsndfile;
58
59 sconsFlags =
60 lib.optionals (!stdenv.hostPlatform.isDarwin) [
61 "--build=${stdenv.buildPlatform.config}"
62 "--host=${stdenv.hostPlatform.config}"
63 ]
64 ++ [ "--prefix=${placeholder "out"}" ]
65 ++ lib.optional (!opensslSupport) "--disable-openssl"
66 ++ lib.optional (!soxSupport) "--disable-sox"
67 ++ lib.optional (!libunwindSupport) "--disable-libunwind"
68 ++ lib.optional (!pulseaudioSupport) "--disable-pulseaudio"
69 ++ lib.optional (!libsndfileSupport) "--disable-sndfile"
70 ++ lib.optional stdenv.hostPlatform.isFreeBSD "--platform=unix"
71 ++ (
72 if (!openfecSupport) then
73 [ "--disable-openfec" ]
74 else
75 [
76 "--with-libraries=${openfec}/lib"
77 "--with-openfec-includes=${openfec.dev}/include"
78 ]
79 );
80
81 env = lib.optionalAttrs stdenv.hostPlatform.isFreeBSD {
82 NIX_CFLAGS_COMPILE = "-D_XOPEN_SOURCE=700 -D__BSD_VISIBLE";
83 NIX_LDFLAGS = "-lpthread";
84 };
85
86 meta = with lib; {
87 description = "Roc is a toolkit for real-time audio streaming over the network";
88 homepage = "https://github.com/roc-streaming/roc-toolkit";
89 license = licenses.mpl20;
90 maintainers = with maintainers; [ bgamari ];
91 platforms = platforms.unix;
92 };
93}