nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

obs-studio: package the missing ndi library to make the obs-ndi plug-in actually work

+87 -6
+17
pkgs/applications/video/obs-studio/hardcode-ndi-path.patch
··· 1 + diff --git a/src/obs-ndi.cpp b/src/obs-ndi.cpp 2 + index 493831c..7b0f8db 100644 3 + --- a/src/obs-ndi.cpp 4 + +++ b/src/obs-ndi.cpp 5 + @@ -197,11 +197,7 @@ const char* obs_module_description() 6 + const NDIlib_v4* load_ndilib() 7 + { 8 + QStringList locations; 9 + - locations << QString(qgetenv(NDILIB_REDIST_FOLDER)); 10 + -#if defined(__linux__) || defined(__APPLE__) 11 + - locations << "/usr/lib"; 12 + - locations << "/usr/local/lib"; 13 + -#endif 14 + + locations << "@NDI@/lib"; 15 + 16 + for (QString path : locations) { 17 + blog(LOG_INFO, "Trying '%s'", path.toUtf8().constData());
+8 -6
pkgs/applications/video/obs-studio/obs-ndi.nix
··· 2 2 # somewhat manually install this: 3 3 4 4 # nix-env -f "<nixpkgs>" -iA obs-ndi 5 - # mkdir -p ~/.config/obs-studio/plugins 6 - # ln -s ~/.nix-profile/share/obs/obs-plugins/obs-ndi ~/.config/obs-studio/plugins/ 5 + # mkdir -p ~/.config/obs-studio/plugins/bin 6 + # ln -s ~/.nix-profile/lib/obs-plugins/obs-ndi.so ~/.config/obs-studio/plugins/bin/ 7 7 8 - { stdenv, fetchFromGitHub, obs-studio, cmake, qt5 }: 8 + { stdenv, fetchFromGitHub, obs-studio, cmake, qt5, ndi }: 9 9 10 10 stdenv.mkDerivation rec { 11 11 pname = "obs-ndi"; 12 12 version = "4.7.1"; 13 + 14 + nativeBuildInputs = [ cmake ]; 15 + buildInputs = [ obs-studio qt5.qtbase ndi ]; 13 16 14 17 src = fetchFromGitHub { 15 18 owner = "Palakis"; ··· 21 18 sha256 = "040fkbf3f3qgqcrd3072y3zrjb4fwga8zr10jym744xd7bgyylqh"; 22 19 }; 23 20 24 - patches = [ ./fix-search-path.patch ]; 21 + patches = [ ./fix-search-path.patch ./hardcode-ndi-path.patch ]; 25 22 26 - nativeBuildInputs = [ cmake ]; 27 - buildInputs = [ obs-studio qt5.qtbase ]; 23 + postPatch = "sed -i -e s,@NDI@,${ndi},g src/obs-ndi.cpp"; 28 24 29 25 cmakeFlags = [ 30 26 "-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs"
+60
pkgs/development/libraries/ndi/default.nix
··· 1 + { stdenv, requireFile, avahi }: 2 + 3 + stdenv.mkDerivation rec { 4 + pname = "ndi"; 5 + version = "4"; 6 + 7 + src = requireFile rec { 8 + name = "InstallNDISDK_v${version}_Linux.tar.gz"; 9 + sha256 = "1hac5npyg8nifs9ipj34pkn0zjyx8774x3i3h8znhmijx2j2982p"; 10 + message = '' 11 + In order to use the NDI SDK, you need to comply with NewTek's license and 12 + download the Linux version ${version} tarball from: 13 + 14 + ${meta.homepage} 15 + 16 + Once you have downloaded the file, please use the following command and 17 + re-run the installation: 18 + 19 + nix-prefetch-url file://\$PWD/${name} 20 + ''; 21 + }; 22 + 23 + buildInputs = [ avahi ]; 24 + 25 + unpackPhase = '' 26 + unpackFile ${src} 27 + echo y | ./InstallNDISDK_v4_Linux.sh 28 + sourceRoot="NDI SDK for Linux"; 29 + ''; 30 + 31 + installPhase = '' 32 + mkdir $out 33 + mv bin/x86_64-linux-gnu $out/bin 34 + for i in $out/bin/*; do 35 + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i" 36 + done 37 + patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" $out/bin/ndi-record 38 + mv lib/x86_64-linux-gnu $out/lib 39 + for i in $out/lib/*; do 40 + if [ -L "$i" ]; then continue; fi 41 + patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" "$i" 42 + done 43 + mv include examples $out/ 44 + mkdir -p $out/share/doc/${pname}-${version} 45 + mv licenses $out/share/doc/${pname}-${version}/licenses 46 + mv logos $out/share/doc/${pname}-${version}/logos 47 + mv documentation/* $out/share/doc/${pname}-${version}/ 48 + ''; 49 + 50 + # Stripping breaks ndi-record. 51 + dontStrip = true; 52 + 53 + meta = with stdenv.lib; { 54 + homepage = "https://ndi.tv/sdk/"; 55 + description = "NDI Software Developer Kit"; 56 + platforms = ["x86_64-linux"]; 57 + hydraPlatforms = []; 58 + license = licenses.unfree; 59 + }; 60 + }
+2
pkgs/top-level/all-packages.nix
··· 13181 13181 then null 13182 13182 else callPackage ../development/libraries/ncurses { }; 13183 13183 13184 + ndi = callPackage ../development/libraries/ndi { }; 13185 + 13184 13186 neardal = callPackage ../development/libraries/neardal { }; 13185 13187 13186 13188 neon = callPackage ../development/libraries/neon { };