From e8e025516256498d4217086e349e6b4b291e352e Mon Sep 17 00:00:00 2001 From: V Date: Thu, 17 Jun 2021 20:05:26 +0200 Subject: obs-studio: add plugin wrapper (#125308) * obs-studio: tidy things up a little * obs-studio: add plugin wrapper This allows users to install plugins into their OBS Studio, like so: wrapOBS { plugins = with obs-studio-plugins; [ wlrobs obs-multi-rtmp obs-gstreamer ]; } * obs-gstreamer: convert to plugin * obs-move-transition: convert to plugin * obs-multi-rtmp: convert to plugin * obs-ndi: convert to plugin * obs-v4l2sink: remove The functionality provided by this package is included in the upstream project as of version 26.1. Link: https://github.com/CatxFish/obs-v4l2sink/issues/56#issuecomment-753191690 Link: https://github.com/obsproject/obs-studio/releases/tag/26.1.0 * wlrobs: convert to plugin, unstable-2020-06-22 -> unstable-2021-05-13 --- pkgs/applications/video/obs-studio/default.nix | 10 ++-- .../video/obs-studio/fix-search-path.patch | 13 ----- .../video/obs-studio/hardcode-ndi-path.patch | 17 ------ .../video/obs-studio/obs-gstreamer.nix | 44 ---------------- .../video/obs-studio/obs-move-transition.nix | 61 ---------------------- .../video/obs-studio/obs-multi-rtmp.nix | 43 --------------- pkgs/applications/video/obs-studio/obs-ndi.nix | 43 --------------- .../video/obs-studio/plugins/default.nix | 9 ++++ .../video/obs-studio/plugins/fix-search-path.patch | 13 +++++ .../obs-studio/plugins/hardcode-ndi-path.patch | 17 ++++++ .../video/obs-studio/plugins/obs-gstreamer.nix | 32 ++++++++++++ .../obs-studio/plugins/obs-move-transition.nix | 49 +++++++++++++++++ .../video/obs-studio/plugins/obs-multi-rtmp.nix | 31 +++++++++++ .../video/obs-studio/plugins/obs-ndi.nix | 36 +++++++++++++ .../plugins/rename-obs-move-transition-cmake.patch | 34 ++++++++++++ .../video/obs-studio/plugins/wlrobs.nix | 26 +++++++++ .../rename-obs-move-transition-cmake.patch | 34 ------------ pkgs/applications/video/obs-studio/v4l2sink.nix | 57 -------------------- pkgs/applications/video/obs-studio/wlrobs.nix | 42 --------------- pkgs/applications/video/obs-studio/wrapper.nix | 21 ++++++++ pkgs/top-level/aliases.nix | 32 ++++++++++++ pkgs/top-level/all-packages.nix | 16 ++---- 22 files changed, 308 insertions(+), 372 deletions(-) delete mode 100644 pkgs/applications/video/obs-studio/fix-search-path.patch delete mode 100644 pkgs/applications/video/obs-studio/hardcode-ndi-path.patch delete mode 100644 pkgs/applications/video/obs-studio/obs-gstreamer.nix delete mode 100644 pkgs/applications/video/obs-studio/obs-move-transition.nix delete mode 100644 pkgs/applications/video/obs-studio/obs-multi-rtmp.nix delete mode 100644 pkgs/applications/video/obs-studio/obs-ndi.nix create mode 100644 pkgs/applications/video/obs-studio/plugins/default.nix create mode 100644 pkgs/applications/video/obs-studio/plugins/fix-search-path.patch create mode 100644 pkgs/applications/video/obs-studio/plugins/hardcode-ndi-path.patch create mode 100644 pkgs/applications/video/obs-studio/plugins/obs-gstreamer.nix create mode 100644 pkgs/applications/video/obs-studio/plugins/obs-move-transition.nix create mode 100644 pkgs/applications/video/obs-studio/plugins/obs-multi-rtmp.nix create mode 100644 pkgs/applications/video/obs-studio/plugins/obs-ndi.nix create mode 100644 pkgs/applications/video/obs-studio/plugins/rename-obs-move-transition-cmake.patch create mode 100644 pkgs/applications/video/obs-studio/plugins/wlrobs.nix delete mode 100644 pkgs/applications/video/obs-studio/rename-obs-move-transition-cmake.patch delete mode 100644 pkgs/applications/video/obs-studio/v4l2sink.nix delete mode 100644 pkgs/applications/video/obs-studio/wlrobs.nix create mode 100644 pkgs/applications/video/obs-studio/wrapper.nix diff --git a/pkgs/applications/video/obs-studio/default.nix b/pkgs/applications/video/obs-studio/default.nix index ff56fa1c0fb..d7784279c31 100644 --- a/pkgs/applications/video/obs-studio/default.nix +++ b/pkgs/applications/video/obs-studio/default.nix @@ -114,13 +114,13 @@ in mkDerivation rec { ]; postInstall = '' - wrapProgram $out/bin/obs \ - --prefix "LD_LIBRARY_PATH" : "${xorg.libX11.out}/lib:${libvlc}/lib" + wrapProgram $out/bin/obs \ + --prefix "LD_LIBRARY_PATH" : "${xorg.libX11.out}/lib:${libvlc}/lib" ''; postFixup = lib.optionalString stdenv.isLinux '' - addOpenGLRunpath $out/lib/lib*.so - addOpenGLRunpath $out/lib/obs-plugins/*.so + addOpenGLRunpath $out/lib/lib*.so + addOpenGLRunpath $out/lib/obs-plugins/*.so ''; meta = with lib; { @@ -131,7 +131,7 @@ in mkDerivation rec { video content, efficiently ''; homepage = "https://obsproject.com"; - maintainers = with maintainers; [ jb55 MP2E ]; + maintainers = with maintainers; [ jb55 MP2E V ]; license = licenses.gpl2; platforms = [ "x86_64-linux" "i686-linux" ]; }; diff --git a/pkgs/applications/video/obs-studio/fix-search-path.patch b/pkgs/applications/video/obs-studio/fix-search-path.patch deleted file mode 100644 index 4503447ff5d..00000000000 --- a/pkgs/applications/video/obs-studio/fix-search-path.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/external/FindLibObs.cmake b/external/FindLibObs.cmake -index ab0a3de..19c63ee 100644 ---- a/external/FindLibObs.cmake -+++ b/external/FindLibObs.cmake -@@ -95,7 +95,7 @@ if(LIBOBS_FOUND) - - set(LIBOBS_INCLUDE_DIRS ${LIBOBS_INCLUDE_DIR} ${W32_PTHREADS_INCLUDE_DIR}) - set(LIBOBS_LIBRARIES ${LIBOBS_LIB} ${W32_PTHREADS_LIB}) -- include(${LIBOBS_INCLUDE_DIR}/../cmake/external/ObsPluginHelpers.cmake) -+ include(external/ObsPluginHelpers.cmake) - - # allows external plugins to easily use/share common dependencies that are often included with libobs (such as FFmpeg) - if(NOT DEFINED INCLUDED_LIBOBS_CMAKE_MODULES) diff --git a/pkgs/applications/video/obs-studio/hardcode-ndi-path.patch b/pkgs/applications/video/obs-studio/hardcode-ndi-path.patch deleted file mode 100644 index caef96c381f..00000000000 --- a/pkgs/applications/video/obs-studio/hardcode-ndi-path.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/src/obs-ndi.cpp b/src/obs-ndi.cpp -index 493831c..7b0f8db 100644 ---- a/src/obs-ndi.cpp -+++ b/src/obs-ndi.cpp -@@ -197,11 +197,7 @@ const char* obs_module_description() - const NDIlib_v4* load_ndilib() - { - QStringList locations; -- locations << QString(qgetenv(NDILIB_REDIST_FOLDER)); --#if defined(__linux__) || defined(__APPLE__) -- locations << "/usr/lib"; -- locations << "/usr/local/lib"; --#endif -+ locations << "@NDI@/lib"; - - for (QString path : locations) { - blog(LOG_INFO, "Trying '%s'", path.toUtf8().constData()); diff --git a/pkgs/applications/video/obs-studio/obs-gstreamer.nix b/pkgs/applications/video/obs-studio/obs-gstreamer.nix deleted file mode 100644 index e32ec7575b2..00000000000 --- a/pkgs/applications/video/obs-studio/obs-gstreamer.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, gst_all_1 -, pkg-config -, meson -, ninja -, obs-studio -}: - -stdenv.mkDerivation rec { - pname = "obs-gstreamer"; - version = "0.2.1"; - - src = fetchFromGitHub { - owner = "fzwoch"; - repo = "obs-gstreamer"; - rev = "v${version}"; - sha256 = "1fdpwr8br8x9cnrhr3j4f0l81df26n3bj2ibi3cg96rl86054nid"; - }; - - nativeBuildInputs = [ pkg-config meson ninja ]; - buildInputs = [ gst_all_1.gstreamermm obs-studio ]; - - # obs-studio expects the shared object to be located in bin/32bit or bin/64bit - # https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48 - postInstall = let - pluginPath = { - i686-linux = "bin/32bit"; - x86_64-linux = "bin/64bit"; - }.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}"); - in '' - mkdir -p $out/share/obs/obs-plugins/obs-gstreamer/${pluginPath} - ln -s $out/lib/obs-plugins/obs-gstreamer.so $out/share/obs/obs-plugins/obs-gstreamer/${pluginPath} - ''; - - meta = with lib; { - description = "An OBS Studio source, encoder and video filter plugin to use GStreamer elements/pipelines in OBS Studio"; - homepage = "https://github.com/fswoch/obs-gstreamer"; - maintainers = with maintainers; [ ahuzik ]; - license = licenses.gpl2Plus; - platforms = [ "x86_64-linux" "i686-linux" ]; - }; -} diff --git a/pkgs/applications/video/obs-studio/obs-move-transition.nix b/pkgs/applications/video/obs-studio/obs-move-transition.nix deleted file mode 100644 index 9a896c7320a..00000000000 --- a/pkgs/applications/video/obs-studio/obs-move-transition.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, fetchpatch -, fetchurl -, cmake -, obs-studio -}: - -stdenv.mkDerivation rec { - pname = "obs-move-transition"; - version = "2.3.0"; - - src = fetchFromGitHub { - owner = "exeldro"; - repo = "obs-move-transition"; - rev = version; - sha256 = "0cl6z3cvdjmbisvfcy281pcg6rhxmyfs31rwv7q4x39352rcs1nw"; - }; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ obs-studio ]; - - cmakeFlags = with lib; [ - "-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs" - "-Wno-dev" - ]; - - preConfigure = '' - cp ${obs-studio.src}/cmake/external/FindLibobs.cmake FindLibobs.cmake - ''; - - patches = [ ./rename-obs-move-transition-cmake.patch ]; - - postPatch = '' - substituteInPlace move-source-filter.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '' - substituteInPlace move-value-filter.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '' - substituteInPlace move-transition.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '' - substituteInPlace audio-move.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '' - ''; - - # obs-studio expects the shared object to be located in bin/32bit or bin/64bit - # https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48 - postInstall = let - pluginPath = { - i686-linux = "bin/32bit"; - x86_64-linux = "bin/64bit"; - }.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}"); - in '' - mkdir -p $out/share/obs/obs-plugins/move-transition/${pluginPath} - ln -s $out/lib/obs-plugins/move-transition.so $out/share/obs/obs-plugins/move-transition/${pluginPath} - ''; - - meta = with lib; { - description = "Plugin for OBS Studio to move source to a new position during scene transition"; - homepage = "https://github.com/exeldro/obs-move-transition"; - maintainers = with maintainers; [ starcraft66 ]; - license = licenses.gpl2Plus; - platforms = [ "x86_64-linux" "i686-linux" ]; - }; -} diff --git a/pkgs/applications/video/obs-studio/obs-multi-rtmp.nix b/pkgs/applications/video/obs-studio/obs-multi-rtmp.nix deleted file mode 100644 index f716d93a360..00000000000 --- a/pkgs/applications/video/obs-studio/obs-multi-rtmp.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ lib, stdenv, fetchFromGitHub, obs-studio, cmake, qtbase }: - -stdenv.mkDerivation rec { - pname = "obs-multi-rtmp"; - version = "0.2.6"; - - src = fetchFromGitHub { - owner = "sorayuki"; - repo = "obs-multi-rtmp"; - rev = version; - sha256 = "sha256-SMcVL54HwFIc7/wejEol2XiZhlZCMVCwHHtIKJ/CoYY="; - }; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ obs-studio qtbase ]; - - cmakeFlags = [ - "-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs" - ]; - - dontWrapQtApps = true; - - # obs-studio expects the shared object to be located in bin/32bit or bin/64bit - # https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48 - postInstall = let - pluginPath = { - i686-linux = "bin/32bit"; - x86_64-linux = "bin/64bit"; - }.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}"); - in '' - mkdir -p $out/share/obs/obs-plugins/obs-multi-rtmp/${pluginPath} - ln -s $out/lib/obs-plugins/obs-multi-rtmp.so $out/share/obs/obs-plugins/obs-multi-rtmp/${pluginPath} - ''; - - meta = with lib; { - homepage = "https://github.com/sorayuki/obs-multi-rtmp/"; - changelog = "https://github.com/sorayuki/obs-multi-rtmp/releases/tag/${version}"; - description = "Multi-site simultaneous broadcast plugin for OBS Studio"; - license = licenses.gpl2Only; - maintainers = with maintainers; [ jk ]; - platforms = [ "x86_64-linux" "i686-linux" ]; - }; -} diff --git a/pkgs/applications/video/obs-studio/obs-ndi.nix b/pkgs/applications/video/obs-studio/obs-ndi.nix deleted file mode 100644 index b35398d65b5..00000000000 --- a/pkgs/applications/video/obs-studio/obs-ndi.nix +++ /dev/null @@ -1,43 +0,0 @@ -# We don't have a wrapper which can supply obs-studio plugins so you have to -# somewhat manually install this: - -# nix-env -f "" -iA obs-ndi -# mkdir -p ~/.config/obs-studio/plugins/bin -# ln -s ~/.nix-profile/lib/obs-plugins/obs-ndi.so ~/.config/obs-studio/plugins/bin/ - -{ lib, stdenv, fetchFromGitHub, obs-studio, cmake, qtbase, ndi }: - -stdenv.mkDerivation rec { - pname = "obs-ndi"; - version = "4.9.1"; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ obs-studio qtbase ndi ]; - - src = fetchFromGitHub { - owner = "Palakis"; - repo = "obs-ndi"; - rev = version; - sha256 = "1y3xdqp55jayhg4sinwiwpk194zc4f4jf0abz647x2fprsk9jz7s"; - }; - - patches = [ ./fix-search-path.patch ./hardcode-ndi-path.patch ]; - - postPatch = "sed -i -e s,@NDI@,${ndi},g src/obs-ndi.cpp"; - - cmakeFlags = [ - "-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs" - "-DLIBOBS_LIB=${obs-studio}/lib" - "-DCMAKE_CXX_FLAGS=-I${obs-studio.src}/UI/obs-frontend-api" - ]; - - dontWrapQtApps = true; - - meta = with lib; { - description = "Network A/V plugin for OBS Studio"; - homepage = "https://github.com/Palakis/obs-ndi"; - maintainers = with maintainers; [ peti jshcmpbll ]; - license = licenses.gpl2; - platforms = with platforms; linux; - }; -} diff --git a/pkgs/applications/video/obs-studio/plugins/default.nix b/pkgs/applications/video/obs-studio/plugins/default.nix new file mode 100644 index 00000000000..477f0efa3e0 --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/default.nix @@ -0,0 +1,9 @@ +{ callPackage, libsForQt5 }: + +{ + obs-gstreamer = callPackage ./obs-gstreamer.nix {}; + obs-move-transition = callPackage ./obs-move-transition.nix {}; + obs-multi-rtmp = libsForQt5.callPackage ./obs-multi-rtmp.nix {}; + obs-ndi = libsForQt5.callPackage ./obs-ndi.nix {}; + wlrobs = callPackage ./wlrobs.nix {}; +} diff --git a/pkgs/applications/video/obs-studio/plugins/fix-search-path.patch b/pkgs/applications/video/obs-studio/plugins/fix-search-path.patch new file mode 100644 index 00000000000..4503447ff5d --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/fix-search-path.patch @@ -0,0 +1,13 @@ +diff --git a/external/FindLibObs.cmake b/external/FindLibObs.cmake +index ab0a3de..19c63ee 100644 +--- a/external/FindLibObs.cmake ++++ b/external/FindLibObs.cmake +@@ -95,7 +95,7 @@ if(LIBOBS_FOUND) + + set(LIBOBS_INCLUDE_DIRS ${LIBOBS_INCLUDE_DIR} ${W32_PTHREADS_INCLUDE_DIR}) + set(LIBOBS_LIBRARIES ${LIBOBS_LIB} ${W32_PTHREADS_LIB}) +- include(${LIBOBS_INCLUDE_DIR}/../cmake/external/ObsPluginHelpers.cmake) ++ include(external/ObsPluginHelpers.cmake) + + # allows external plugins to easily use/share common dependencies that are often included with libobs (such as FFmpeg) + if(NOT DEFINED INCLUDED_LIBOBS_CMAKE_MODULES) diff --git a/pkgs/applications/video/obs-studio/plugins/hardcode-ndi-path.patch b/pkgs/applications/video/obs-studio/plugins/hardcode-ndi-path.patch new file mode 100644 index 00000000000..caef96c381f --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/hardcode-ndi-path.patch @@ -0,0 +1,17 @@ +diff --git a/src/obs-ndi.cpp b/src/obs-ndi.cpp +index 493831c..7b0f8db 100644 +--- a/src/obs-ndi.cpp ++++ b/src/obs-ndi.cpp +@@ -197,11 +197,7 @@ const char* obs_module_description() + const NDIlib_v4* load_ndilib() + { + QStringList locations; +- locations << QString(qgetenv(NDILIB_REDIST_FOLDER)); +-#if defined(__linux__) || defined(__APPLE__) +- locations << "/usr/lib"; +- locations << "/usr/local/lib"; +-#endif ++ locations << "@NDI@/lib"; + + for (QString path : locations) { + blog(LOG_INFO, "Trying '%s'", path.toUtf8().constData()); diff --git a/pkgs/applications/video/obs-studio/plugins/obs-gstreamer.nix b/pkgs/applications/video/obs-studio/plugins/obs-gstreamer.nix new file mode 100644 index 00000000000..d21d78c42b2 --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/obs-gstreamer.nix @@ -0,0 +1,32 @@ +{ lib +, stdenv +, fetchFromGitHub +, gst_all_1 +, pkg-config +, meson +, ninja +, obs-studio +}: + +stdenv.mkDerivation rec { + pname = "obs-gstreamer"; + version = "0.2.1"; + + src = fetchFromGitHub { + owner = "fzwoch"; + repo = "obs-gstreamer"; + rev = "v${version}"; + sha256 = "1fdpwr8br8x9cnrhr3j4f0l81df26n3bj2ibi3cg96rl86054nid"; + }; + + nativeBuildInputs = [ pkg-config meson ninja ]; + buildInputs = [ gst_all_1.gstreamermm obs-studio ]; + + meta = with lib; { + description = "An OBS Studio source, encoder and video filter plugin to use GStreamer elements/pipelines in OBS Studio"; + homepage = "https://github.com/fswoch/obs-gstreamer"; + maintainers = with maintainers; [ ahuzik ]; + license = licenses.gpl2Plus; + platforms = [ "x86_64-linux" "i686-linux" ]; + }; +} diff --git a/pkgs/applications/video/obs-studio/plugins/obs-move-transition.nix b/pkgs/applications/video/obs-studio/plugins/obs-move-transition.nix new file mode 100644 index 00000000000..befc27dd5dc --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/obs-move-transition.nix @@ -0,0 +1,49 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, fetchurl +, cmake +, obs-studio +}: + +stdenv.mkDerivation rec { + pname = "obs-move-transition"; + version = "2.3.0"; + + src = fetchFromGitHub { + owner = "exeldro"; + repo = "obs-move-transition"; + rev = version; + sha256 = "0cl6z3cvdjmbisvfcy281pcg6rhxmyfs31rwv7q4x39352rcs1nw"; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ obs-studio ]; + + cmakeFlags = with lib; [ + "-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs" + "-Wno-dev" + ]; + + preConfigure = '' + cp ${obs-studio.src}/cmake/external/FindLibobs.cmake FindLibobs.cmake + ''; + + patches = [ ./rename-obs-move-transition-cmake.patch ]; + + postPatch = '' + substituteInPlace move-source-filter.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '' + substituteInPlace move-value-filter.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '' + substituteInPlace move-transition.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '' + substituteInPlace audio-move.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '' + ''; + + meta = with lib; { + description = "Plugin for OBS Studio to move source to a new position during scene transition"; + homepage = "https://github.com/exeldro/obs-move-transition"; + maintainers = with maintainers; [ starcraft66 ]; + license = licenses.gpl2Plus; + platforms = [ "x86_64-linux" "i686-linux" ]; + }; +} diff --git a/pkgs/applications/video/obs-studio/plugins/obs-multi-rtmp.nix b/pkgs/applications/video/obs-studio/plugins/obs-multi-rtmp.nix new file mode 100644 index 00000000000..0122cba0f3d --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/obs-multi-rtmp.nix @@ -0,0 +1,31 @@ +{ lib, stdenv, fetchFromGitHub, obs-studio, cmake, qtbase }: + +stdenv.mkDerivation rec { + pname = "obs-multi-rtmp"; + version = "0.2.6"; + + src = fetchFromGitHub { + owner = "sorayuki"; + repo = "obs-multi-rtmp"; + rev = version; + sha256 = "sha256-SMcVL54HwFIc7/wejEol2XiZhlZCMVCwHHtIKJ/CoYY="; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ obs-studio qtbase ]; + + cmakeFlags = [ + "-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs" + ]; + + dontWrapQtApps = true; + + meta = with lib; { + homepage = "https://github.com/sorayuki/obs-multi-rtmp/"; + changelog = "https://github.com/sorayuki/obs-multi-rtmp/releases/tag/${version}"; + description = "Multi-site simultaneous broadcast plugin for OBS Studio"; + license = licenses.gpl2Only; + maintainers = with maintainers; [ jk ]; + platforms = [ "x86_64-linux" "i686-linux" ]; + }; +} diff --git a/pkgs/applications/video/obs-studio/plugins/obs-ndi.nix b/pkgs/applications/video/obs-studio/plugins/obs-ndi.nix new file mode 100644 index 00000000000..1e2abb45a5b --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/obs-ndi.nix @@ -0,0 +1,36 @@ +{ lib, stdenv, fetchFromGitHub, obs-studio, cmake, qtbase, ndi }: + +stdenv.mkDerivation rec { + pname = "obs-ndi"; + version = "4.9.1"; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ obs-studio qtbase ndi ]; + + src = fetchFromGitHub { + owner = "Palakis"; + repo = "obs-ndi"; + rev = version; + sha256 = "1y3xdqp55jayhg4sinwiwpk194zc4f4jf0abz647x2fprsk9jz7s"; + }; + + patches = [ ./fix-search-path.patch ./hardcode-ndi-path.patch ]; + + postPatch = "sed -i -e s,@NDI@,${ndi},g src/obs-ndi.cpp"; + + cmakeFlags = [ + "-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs" + "-DLIBOBS_LIB=${obs-studio}/lib" + "-DCMAKE_CXX_FLAGS=-I${obs-studio.src}/UI/obs-frontend-api" + ]; + + dontWrapQtApps = true; + + meta = with lib; { + description = "Network A/V plugin for OBS Studio"; + homepage = "https://github.com/Palakis/obs-ndi"; + maintainers = with maintainers; [ peti jshcmpbll ]; + license = licenses.gpl2; + platforms = with platforms; linux; + }; +} diff --git a/pkgs/applications/video/obs-studio/plugins/rename-obs-move-transition-cmake.patch b/pkgs/applications/video/obs-studio/plugins/rename-obs-move-transition-cmake.patch new file mode 100644 index 00000000000..ed6df1d565d --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/rename-obs-move-transition-cmake.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d116619..a1366ce 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,17 @@ ++if (POLICY CMP0048) ++ cmake_policy(SET CMP0048 NEW) ++endif (POLICY CMP0048) ++ + project(move-transition VERSION 2.3.0) + set(PROJECT_FULL_NAME "Move Transition") + ++include(FindLibobs.cmake) ++find_package(LibObs REQUIRED) ++ ++include_directories( ++ "${LIBOBS_INCLUDE_DIR}/../plugins/obs-transitions" ++ "${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api") ++ + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/version.h) + + set(move-transition_HEADERS +@@ -34,4 +45,10 @@ target_link_libraries(move-transition + libobs) + + set_target_properties(move-transition PROPERTIES FOLDER "plugins/exeldro") +-install_obs_plugin_with_data(move-transition data) ++set_target_properties(move-transition PROPERTIES PREFIX "") ++ ++install(TARGETS move-transition ++ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/obs-plugins) ++ ++install(DIRECTORY data/locale/ ++ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/obs/obs-plugins/move-transition/locale") diff --git a/pkgs/applications/video/obs-studio/plugins/wlrobs.nix b/pkgs/applications/video/obs-studio/plugins/wlrobs.nix new file mode 100644 index 00000000000..adae03036f8 --- /dev/null +++ b/pkgs/applications/video/obs-studio/plugins/wlrobs.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchhg +, meson, pkg-config, ninja +, wayland, obs-studio, libX11 +}: + +stdenv.mkDerivation { + pname = "wlrobs"; + version = "unstable-2021-05-13"; + + src = fetchhg { + url = "https://hg.sr.ht/~scoopta/wlrobs"; + rev = "4184a4a8ea7dc054c993efa16007f3a75b2c6f51"; + sha256 = "146xirzd3nw1sd216y406v1riky9k08b6a0j4kwxrif5zyqa3adc"; + }; + + nativeBuildInputs = [ meson pkg-config ninja ]; + buildInputs = [ wayland obs-studio libX11 ]; + + meta = with lib; { + description = "An obs-studio plugin that allows you to screen capture on wlroots based wayland compositors"; + homepage = "https://hg.sr.ht/~scoopta/wlrobs"; + maintainers = with maintainers; [ grahamc V ]; + license = licenses.gpl3Plus; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/applications/video/obs-studio/rename-obs-move-transition-cmake.patch b/pkgs/applications/video/obs-studio/rename-obs-move-transition-cmake.patch deleted file mode 100644 index ed6df1d565d..00000000000 --- a/pkgs/applications/video/obs-studio/rename-obs-move-transition-cmake.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d116619..a1366ce 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,17 @@ -+if (POLICY CMP0048) -+ cmake_policy(SET CMP0048 NEW) -+endif (POLICY CMP0048) -+ - project(move-transition VERSION 2.3.0) - set(PROJECT_FULL_NAME "Move Transition") - -+include(FindLibobs.cmake) -+find_package(LibObs REQUIRED) -+ -+include_directories( -+ "${LIBOBS_INCLUDE_DIR}/../plugins/obs-transitions" -+ "${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api") -+ - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/version.h) - - set(move-transition_HEADERS -@@ -34,4 +45,10 @@ target_link_libraries(move-transition - libobs) - - set_target_properties(move-transition PROPERTIES FOLDER "plugins/exeldro") --install_obs_plugin_with_data(move-transition data) -+set_target_properties(move-transition PROPERTIES PREFIX "") -+ -+install(TARGETS move-transition -+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/obs-plugins) -+ -+install(DIRECTORY data/locale/ -+ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/obs/obs-plugins/move-transition/locale") diff --git a/pkgs/applications/video/obs-studio/v4l2sink.nix b/pkgs/applications/video/obs-studio/v4l2sink.nix deleted file mode 100644 index 2716120682e..00000000000 --- a/pkgs/applications/video/obs-studio/v4l2sink.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, fetchpatch -, cmake -, qtbase -, obs-studio -}: - -stdenv.mkDerivation rec { - pname = "obs-v4l2sink"; - version = "0.1.0-12-g1ec3c8a"; - - src = fetchFromGitHub { - owner = "CatxFish"; - repo = "obs-v4l2sink"; - rev = version; - sha256 = "03ah91cm1qz26k90mfx51l0d598i9bcmw39lkikjs1msm4c9dfxx"; - }; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ qtbase obs-studio ]; - - dontWrapQtApps = true; - - patches = [ - # Fixes the segfault when stopping the plugin - (fetchpatch { - url = "https://github.com/CatxFish/obs-v4l2sink/commit/6604f01796d1b84a95714730ea51a6b8ac0e450b.diff"; - sha256 = "0crcvw02dj0aqy7hnhizjdsnhiw03zmg6cbdkasxz2mrrbyc3s88"; - }) - ]; - - cmakeFlags = with lib; [ - "-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs" - ]; - - # obs-studio expects the shared object to be located in bin/32bit or bin/64bit - # https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48 - postInstall = let - pluginPath = { - i686-linux = "bin/32bit"; - x86_64-linux = "bin/64bit"; - }.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}"); - in '' - mkdir -p $out/share/obs/obs-plugins/v4l2sink/${pluginPath} - ln -s $out/lib/obs-plugins/v4l2sink.so $out/share/obs/obs-plugins/v4l2sink/${pluginPath} - ''; - - meta = with lib; { - description = "obs studio output plugin for Video4Linux2 device"; - homepage = "https://github.com/CatxFish/obs-v4l2sink"; - maintainers = with maintainers; [ colemickens peelz ]; - license = licenses.gpl2; - platforms = [ "x86_64-linux" "i686-linux" ]; - }; -} diff --git a/pkgs/applications/video/obs-studio/wlrobs.nix b/pkgs/applications/video/obs-studio/wlrobs.nix deleted file mode 100644 index 47f6ea9e5dd..00000000000 --- a/pkgs/applications/video/obs-studio/wlrobs.nix +++ /dev/null @@ -1,42 +0,0 @@ -# (the following is somewhat lifted from ./linuxbrowser.nix) -# We don't have a wrapper which can supply obs-studio plugins so you have to -# somewhat manually install this: - -# nix-env -f . -iA obs-wlrobs -# mkdir -p ~/.config/obs-studio/plugins/wlrobs/bin/64bit -# ln -s ~/.nix-profile/share/obs/obs-plugins/wlrobs/bin/64bit/libwlrobs.so ~/.config/obs-studio/plugins/wlrobs/bin/64bit -{ stdenv, fetchhg, wayland, obs-studio -, meson, ninja, pkg-config, libX11 -, dmabufSupport ? false, libdrm ? null, libGL ? null, lib}: - -assert dmabufSupport -> libdrm != null && libGL != null; - -stdenv.mkDerivation { - pname = "obs-wlrobs"; - version = "20200622"; - - src = fetchhg { - url = "https://hg.sr.ht/~scoopta/wlrobs"; - rev = "1d3acaaf64049da3da9721aa8b9b47582fe0081b"; - sha256 = "0qrcf8024r4ynfjw0zx8vn59ygx9q5rb196s6nyxmy3gkv2lfxlq"; - }; - - buildInputs = [ libX11 libGL libdrm meson ninja pkg-config wayland obs-studio ]; - - installPhase = '' - mkdir -p $out/share/obs/obs-plugins/wlrobs/bin/64bit - cp ./libwlrobs.so $out/share/obs/obs-plugins/wlrobs/bin/64bit/ - ''; - - mesonFlags = [ - "-Duse_dmabuf=${lib.boolToString dmabufSupport}" - ]; - - meta = with lib; { - description = "An obs-studio plugin that allows you to screen capture on wlroots based wayland compositors"; - homepage = "https://hg.sr.ht/~scoopta/wlrobs"; - maintainers = with maintainers; [ grahamc ]; - license = licenses.gpl3; - platforms = [ "x86_64-linux" ]; - }; -} diff --git a/pkgs/applications/video/obs-studio/wrapper.nix b/pkgs/applications/video/obs-studio/wrapper.nix new file mode 100644 index 00000000000..3871151bbb2 --- /dev/null +++ b/pkgs/applications/video/obs-studio/wrapper.nix @@ -0,0 +1,21 @@ +{ obs-studio, symlinkJoin, makeWrapper }: + +{ plugins ? [] }: + +symlinkJoin { + name = "wrapped-${obs-studio.name}"; + + nativeBuildInputs = [ makeWrapper ]; + paths = [ obs-studio ] ++ plugins; + + postBuild = '' + wrapProgram $out/bin/obs \ + --set OBS_PLUGINS_PATH "$out/lib/obs-plugins" \ + --set OBS_PLUGINS_DATA_PATH "$out/share/obs/obs-plugins" + ''; + + inherit (obs-studio) meta; + passthru = obs-studio.passthru // { + passthru.unwrapped = obs-studio; + }; +} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index ed0f82e9404..c4e214ab6cb 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1018,6 +1018,38 @@ mapAliases ({ & maintenance is abandoned by upstream. ''; + # Added 2021-06-01 + obs-gstreamer = throw '' + obs-gstreamer has been converted into a plugin for use with wrapOBS. + Its new location is obs-studio-plugins.obs-gstreamer. + ''; + + # Added 2021-06-01 + obs-move-transition = throw '' + obs-move-transition has been converted into a plugin for use with wrapOBS. + Its new location is obs-studio-plugins.obs-move-transition. + ''; + + # Added 2021-06-01 + obs-multi-rtmp = throw '' + obs-multi-rtmp has been converted into a plugin for use with wrapOBS. + Its new location is obs-studio-plugins.obs-multi-rtmp. + ''; + + # Added 2021-06-01 + obs-ndi = throw '' + obs-ndi has been converted into a plugin for use with wrapOBS. + Its new location is obs-studio-plugins.obs-ndi. + ''; + + obs-v4l2sink = throw "obs-v4l2sink is integrated into upstream OBS since version 26.1"; # Added 2021-06-01 + + # Added 2021-06-01 + obs-wlrobs = throw '' + wlrobs has been converted into a plugin for use with wrapOBS. + Its new location is obs-studio-plugins.wlrobs. + ''; + /* If these are in the scope of all-packages.nix, they cause collisions between mixed versions of qt. See: https://github.com/NixOS/nixpkgs/pull/101369 */ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 45423ab1491..59ebd860a11 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25819,19 +25819,9 @@ in oberon-risc-emu = callPackage ../misc/emulators/oberon-risc-emu { }; - obs-studio = libsForQt5.callPackage ../applications/video/obs-studio { }; - - obs-wlrobs = callPackage ../applications/video/obs-studio/wlrobs.nix { }; - - obs-gstreamer = callPackage ../applications/video/obs-studio/obs-gstreamer.nix { }; - - obs-move-transition = callPackage ../applications/video/obs-studio/obs-move-transition.nix { }; - - obs-multi-rtmp = libsForQt5.callPackage ../applications/video/obs-studio/obs-multi-rtmp.nix { }; - - obs-v4l2sink = libsForQt5.callPackage ../applications/video/obs-studio/v4l2sink.nix { }; - - obs-ndi = libsForQt5.callPackage ../applications/video/obs-studio/obs-ndi.nix { }; + obs-studio = libsForQt5.callPackage ../applications/video/obs-studio {}; + obs-studio-plugins = callPackage ../applications/video/obs-studio/plugins {}; + wrapOBS = callPackage ../applications/video/obs-studio/wrapper.nix {}; obsidian = callPackage ../applications/misc/obsidian { }; -- cgit 1.4.1