nixpkgs/pkgs/development/libraries/ndi/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2024-03-23 03:38:09 +00:00
{ lib, stdenv, fetchurl, avahi, obs-studio-plugins }:
2022-07-15 16:38:59 +00:00
let
versionJSON = lib.importJSON ./version.json;
2023-12-04 16:01:32 +00:00
ndiPlatform =
if stdenv.hostPlatform.isAarch64 then "aarch64-rpi4-linux-gnueabi"
else if stdenv.hostPlatform.isAarch32 then "arm-rpi2-linux-gnueabihf"
else if stdenv.hostPlatform.isx86_64 then "x86_64-linux-gnu"
else if stdenv.hostPlatform.isi686 then "i686-linux-gnu"
else throw "unsupported platform for NDI SDK";
2022-07-15 16:38:59 +00:00
in
stdenv.mkDerivation rec {
pname = "ndi";
2022-07-15 16:38:59 +00:00
version = versionJSON.version;
majorVersion = builtins.head (builtins.splitVersion version);
installerName = "Install_NDI_SDK_v${majorVersion}_Linux";
2024-03-23 03:38:09 +00:00
src = fetchurl {
name = "${pname}-${version}.tar.gz";
url = "https://downloads.ndi.tv/SDK/NDI_SDK_Linux/${installerName}.tar.gz";
hash = versionJSON.hash;
};
buildInputs = [ avahi ];
unpackPhase = ''
unpackFile $src
2022-07-15 16:38:59 +00:00
echo y | ./${installerName}.sh
sourceRoot="NDI SDK for Linux";
'';
installPhase = ''
mkdir $out
2023-12-04 16:01:32 +00:00
mv bin/${ndiPlatform} $out/bin
for i in $out/bin/*; do
2023-12-04 16:01:32 +00:00
if [ -L "$i" ]; then continue; fi
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
2023-12-04 16:01:32 +00:00
mv lib/${ndiPlatform} $out/lib
for i in $out/lib/*; do
if [ -L "$i" ]; then continue; fi
patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" "$i"
done
2024-03-23 03:38:09 +00:00
rm $out/bin/libndi.so.${majorVersion}
ln -s $out/lib/libndi.so.${version} $out/bin/libndi.so.${majorVersion}
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-07-15 16:38:59 +00:00
passthru.tests = {
inherit (obs-studio-plugins) obs-ndi;
};
passthru.updateScript = ./update.py;
meta = with lib; {
2023-12-04 16:01:32 +00:00
homepage = "https://ndi.video/ndi-sdk/";
description = "NDI Software Developer Kit";
2023-12-04 16:01:32 +00:00
platforms = ["x86_64-linux" "i686-linux" "aarch64-linux" "armv7l-linux"];
hydraPlatforms = [];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
};
}