2022-09-09 14:08:57 +00:00
|
|
|
{ lib, stdenv, requireFile, avahi, obs-studio-plugins }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
let
|
2023-05-24 13:37:59 +00:00
|
|
|
versionJSON = lib.importJSON ./version.json;
|
2024-01-25 14:12:00 +00:00
|
|
|
ndiPlatform =
|
|
|
|
if stdenv.isAarch64 then "aarch64-rpi4-linux-gnueabi"
|
|
|
|
else if stdenv.isAarch32 then "arm-rpi2-linux-gnueabihf"
|
|
|
|
else if stdenv.isx86_64 then "x86_64-linux-gnu"
|
|
|
|
else if stdenv.isi686 then "i686-linux-gnu"
|
|
|
|
else throw "unsupported platform for NDI SDK";
|
2022-09-09 14:08:57 +00:00
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ndi";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = versionJSON.version;
|
|
|
|
majorVersion = builtins.head (builtins.splitVersion version);
|
|
|
|
installerName = "Install_NDI_SDK_v${majorVersion}_Linux";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = requireFile rec {
|
2022-09-09 14:08:57 +00:00
|
|
|
name = "${installerName}.tar.gz";
|
|
|
|
sha256 = versionJSON.hash;
|
2020-04-24 23:36:52 +00:00
|
|
|
message = ''
|
2022-09-09 14:08:57 +00:00
|
|
|
In order to use NDI SDK version ${version}, you need to comply with
|
2020-04-24 23:36:52 +00:00
|
|
|
NewTek's license and download the appropriate Linux tarball from:
|
|
|
|
|
|
|
|
${meta.homepage}
|
|
|
|
|
|
|
|
Once you have downloaded the file, please use the following command and
|
|
|
|
re-run the installation:
|
|
|
|
|
|
|
|
\$ nix-prefetch-url file://\$PWD/${name}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ avahi ];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
2023-07-15 17:15:38 +00:00
|
|
|
unpackFile $src
|
2022-09-09 14:08:57 +00:00
|
|
|
echo y | ./${installerName}.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
sourceRoot="NDI SDK for Linux";
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
2024-01-25 14:12:00 +00:00
|
|
|
mv bin/${ndiPlatform} $out/bin
|
2020-04-24 23:36:52 +00:00
|
|
|
for i in $out/bin/*; do
|
2024-01-25 14:12:00 +00:00
|
|
|
if [ -L "$i" ]; then continue; fi
|
2020-04-24 23:36:52 +00:00
|
|
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i"
|
|
|
|
done
|
|
|
|
patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" $out/bin/ndi-record
|
2024-01-25 14:12:00 +00:00
|
|
|
mv lib/${ndiPlatform} $out/lib
|
2020-04-24 23:36:52 +00:00
|
|
|
for i in $out/lib/*; do
|
|
|
|
if [ -L "$i" ]; then continue; fi
|
|
|
|
patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" "$i"
|
|
|
|
done
|
|
|
|
mv include examples $out/
|
|
|
|
mkdir -p $out/share/doc/${pname}-${version}
|
|
|
|
mv licenses $out/share/doc/${pname}-${version}/licenses
|
|
|
|
mv documentation/* $out/share/doc/${pname}-${version}/
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Stripping breaks ndi-record.
|
|
|
|
dontStrip = true;
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (obs-studio-plugins) obs-ndi;
|
|
|
|
};
|
|
|
|
passthru.updateScript = ./update.py;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2024-01-25 14:12:00 +00:00
|
|
|
homepage = "https://ndi.video/ndi-sdk/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "NDI Software Developer Kit";
|
2024-01-25 14:12:00 +00:00
|
|
|
platforms = ["x86_64-linux" "i686-linux" "aarch64-linux" "armv7l-linux"];
|
2020-04-24 23:36:52 +00:00
|
|
|
hydraPlatforms = [];
|
2022-06-26 10:26:21 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.unfree;
|
|
|
|
};
|
|
|
|
}
|