1{ lib, stdenv, requireFile, avahi, obs-studio-plugins }:
2
3let
4 versionJSON = lib.importJSON ./version.json;
5in
6stdenv.mkDerivation rec {
7 pname = "ndi";
8 version = versionJSON.version;
9 majorVersion = builtins.head (builtins.splitVersion version);
10 installerName = "Install_NDI_SDK_v${majorVersion}_Linux";
11
12 src = requireFile rec {
13 name = "${installerName}.tar.gz";
14 sha256 = versionJSON.hash;
15 message = ''
16 In order to use NDI SDK version ${version}, you need to comply with
17 NewTek's license and download the appropriate Linux tarball from:
18
19 ${meta.homepage}
20
21 Once you have downloaded the file, please use the following command and
22 re-run the installation:
23
24 \$ nix-prefetch-url file://\$PWD/${name}
25 '';
26 };
27
28 buildInputs = [ avahi ];
29
30 unpackPhase = ''
31 unpackFile $src
32 echo y | ./${installerName}.sh
33 sourceRoot="NDI SDK for Linux";
34 '';
35
36 installPhase = ''
37 mkdir $out
38 mv bin/x86_64-linux-gnu $out/bin
39 for i in $out/bin/*; do
40 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i"
41 done
42 patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" $out/bin/ndi-record
43 mv lib/x86_64-linux-gnu $out/lib
44 for i in $out/lib/*; do
45 if [ -L "$i" ]; then continue; fi
46 patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" "$i"
47 done
48 mv include examples $out/
49 mkdir -p $out/share/doc/${pname}-${version}
50 mv licenses $out/share/doc/${pname}-${version}/licenses
51 mv logos $out/share/doc/${pname}-${version}/logos
52 mv documentation/* $out/share/doc/${pname}-${version}/
53 '';
54
55 # Stripping breaks ndi-record.
56 dontStrip = true;
57
58 passthru.tests = {
59 inherit (obs-studio-plugins) obs-ndi;
60 };
61 passthru.updateScript = ./update.py;
62
63 meta = with lib; {
64 homepage = "https://ndi.tv/sdk/";
65 description = "NDI Software Developer Kit";
66 platforms = ["x86_64-linux"];
67 hydraPlatforms = [];
68 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
69 license = licenses.unfree;
70 };
71}