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

authored by

V and committed by
GitHub
e8e02551 b26545db

+159 -223
+5 -5
pkgs/applications/video/obs-studio/default.nix
··· 114 ]; 115 116 postInstall = '' 117 - wrapProgram $out/bin/obs \ 118 - --prefix "LD_LIBRARY_PATH" : "${xorg.libX11.out}/lib:${libvlc}/lib" 119 ''; 120 121 postFixup = lib.optionalString stdenv.isLinux '' 122 - addOpenGLRunpath $out/lib/lib*.so 123 - addOpenGLRunpath $out/lib/obs-plugins/*.so 124 ''; 125 126 meta = with lib; { ··· 131 video content, efficiently 132 ''; 133 homepage = "https://obsproject.com"; 134 - maintainers = with maintainers; [ jb55 MP2E ]; 135 license = licenses.gpl2; 136 platforms = [ "x86_64-linux" "i686-linux" ]; 137 };
··· 114 ]; 115 116 postInstall = '' 117 + wrapProgram $out/bin/obs \ 118 + --prefix "LD_LIBRARY_PATH" : "${xorg.libX11.out}/lib:${libvlc}/lib" 119 ''; 120 121 postFixup = lib.optionalString stdenv.isLinux '' 122 + addOpenGLRunpath $out/lib/lib*.so 123 + addOpenGLRunpath $out/lib/obs-plugins/*.so 124 ''; 125 126 meta = with lib; { ··· 131 video content, efficiently 132 ''; 133 homepage = "https://obsproject.com"; 134 + maintainers = with maintainers; [ jb55 MP2E V ]; 135 license = licenses.gpl2; 136 platforms = [ "x86_64-linux" "i686-linux" ]; 137 };
pkgs/applications/video/obs-studio/fix-search-path.patch pkgs/applications/video/obs-studio/plugins/fix-search-path.patch
pkgs/applications/video/obs-studio/hardcode-ndi-path.patch pkgs/applications/video/obs-studio/plugins/hardcode-ndi-path.patch
-44
pkgs/applications/video/obs-studio/obs-gstreamer.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , gst_all_1 5 - , pkg-config 6 - , meson 7 - , ninja 8 - , obs-studio 9 - }: 10 - 11 - stdenv.mkDerivation rec { 12 - pname = "obs-gstreamer"; 13 - version = "0.2.1"; 14 - 15 - src = fetchFromGitHub { 16 - owner = "fzwoch"; 17 - repo = "obs-gstreamer"; 18 - rev = "v${version}"; 19 - sha256 = "1fdpwr8br8x9cnrhr3j4f0l81df26n3bj2ibi3cg96rl86054nid"; 20 - }; 21 - 22 - nativeBuildInputs = [ pkg-config meson ninja ]; 23 - buildInputs = [ gst_all_1.gstreamermm obs-studio ]; 24 - 25 - # obs-studio expects the shared object to be located in bin/32bit or bin/64bit 26 - # https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48 27 - postInstall = let 28 - pluginPath = { 29 - i686-linux = "bin/32bit"; 30 - x86_64-linux = "bin/64bit"; 31 - }.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}"); 32 - in '' 33 - mkdir -p $out/share/obs/obs-plugins/obs-gstreamer/${pluginPath} 34 - ln -s $out/lib/obs-plugins/obs-gstreamer.so $out/share/obs/obs-plugins/obs-gstreamer/${pluginPath} 35 - ''; 36 - 37 - meta = with lib; { 38 - description = "An OBS Studio source, encoder and video filter plugin to use GStreamer elements/pipelines in OBS Studio"; 39 - homepage = "https://github.com/fswoch/obs-gstreamer"; 40 - maintainers = with maintainers; [ ahuzik ]; 41 - license = licenses.gpl2Plus; 42 - platforms = [ "x86_64-linux" "i686-linux" ]; 43 - }; 44 - }
···
-12
pkgs/applications/video/obs-studio/obs-move-transition.nix pkgs/applications/video/obs-studio/plugins/obs-move-transition.nix
··· 39 substituteInPlace audio-move.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '<obs-frontend-api.h>' 40 ''; 41 42 - # obs-studio expects the shared object to be located in bin/32bit or bin/64bit 43 - # https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48 44 - postInstall = let 45 - pluginPath = { 46 - i686-linux = "bin/32bit"; 47 - x86_64-linux = "bin/64bit"; 48 - }.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}"); 49 - in '' 50 - mkdir -p $out/share/obs/obs-plugins/move-transition/${pluginPath} 51 - ln -s $out/lib/obs-plugins/move-transition.so $out/share/obs/obs-plugins/move-transition/${pluginPath} 52 - ''; 53 - 54 meta = with lib; { 55 description = "Plugin for OBS Studio to move source to a new position during scene transition"; 56 homepage = "https://github.com/exeldro/obs-move-transition";
··· 39 substituteInPlace audio-move.c --replace '<../UI/obs-frontend-api/obs-frontend-api.h>' '<obs-frontend-api.h>' 40 ''; 41 42 meta = with lib; { 43 description = "Plugin for OBS Studio to move source to a new position during scene transition"; 44 homepage = "https://github.com/exeldro/obs-move-transition";
-43
pkgs/applications/video/obs-studio/obs-multi-rtmp.nix
··· 1 - { lib, stdenv, fetchFromGitHub, obs-studio, cmake, qtbase }: 2 - 3 - stdenv.mkDerivation rec { 4 - pname = "obs-multi-rtmp"; 5 - version = "0.2.6"; 6 - 7 - src = fetchFromGitHub { 8 - owner = "sorayuki"; 9 - repo = "obs-multi-rtmp"; 10 - rev = version; 11 - sha256 = "sha256-SMcVL54HwFIc7/wejEol2XiZhlZCMVCwHHtIKJ/CoYY="; 12 - }; 13 - 14 - nativeBuildInputs = [ cmake ]; 15 - buildInputs = [ obs-studio qtbase ]; 16 - 17 - cmakeFlags = [ 18 - "-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs" 19 - ]; 20 - 21 - dontWrapQtApps = true; 22 - 23 - # obs-studio expects the shared object to be located in bin/32bit or bin/64bit 24 - # https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48 25 - postInstall = let 26 - pluginPath = { 27 - i686-linux = "bin/32bit"; 28 - x86_64-linux = "bin/64bit"; 29 - }.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}"); 30 - in '' 31 - mkdir -p $out/share/obs/obs-plugins/obs-multi-rtmp/${pluginPath} 32 - ln -s $out/lib/obs-plugins/obs-multi-rtmp.so $out/share/obs/obs-plugins/obs-multi-rtmp/${pluginPath} 33 - ''; 34 - 35 - meta = with lib; { 36 - homepage = "https://github.com/sorayuki/obs-multi-rtmp/"; 37 - changelog = "https://github.com/sorayuki/obs-multi-rtmp/releases/tag/${version}"; 38 - description = "Multi-site simultaneous broadcast plugin for OBS Studio"; 39 - license = licenses.gpl2Only; 40 - maintainers = with maintainers; [ jk ]; 41 - platforms = [ "x86_64-linux" "i686-linux" ]; 42 - }; 43 - }
···
-7
pkgs/applications/video/obs-studio/obs-ndi.nix pkgs/applications/video/obs-studio/plugins/obs-ndi.nix
··· 1 - # We don't have a wrapper which can supply obs-studio plugins so you have to 2 - # somewhat manually install this: 3 - 4 - # nix-env -f "<nixpkgs>" -iA obs-ndi 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 - 8 { lib, stdenv, fetchFromGitHub, obs-studio, cmake, qtbase, ndi }: 9 10 stdenv.mkDerivation rec {
··· 1 { lib, stdenv, fetchFromGitHub, obs-studio, cmake, qtbase, ndi }: 2 3 stdenv.mkDerivation rec {
+9
pkgs/applications/video/obs-studio/plugins/default.nix
···
··· 1 + { callPackage, libsForQt5 }: 2 + 3 + { 4 + obs-gstreamer = callPackage ./obs-gstreamer.nix {}; 5 + obs-move-transition = callPackage ./obs-move-transition.nix {}; 6 + obs-multi-rtmp = libsForQt5.callPackage ./obs-multi-rtmp.nix {}; 7 + obs-ndi = libsForQt5.callPackage ./obs-ndi.nix {}; 8 + wlrobs = callPackage ./wlrobs.nix {}; 9 + }
+32
pkgs/applications/video/obs-studio/plugins/obs-gstreamer.nix
···
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , gst_all_1 5 + , pkg-config 6 + , meson 7 + , ninja 8 + , obs-studio 9 + }: 10 + 11 + stdenv.mkDerivation rec { 12 + pname = "obs-gstreamer"; 13 + version = "0.2.1"; 14 + 15 + src = fetchFromGitHub { 16 + owner = "fzwoch"; 17 + repo = "obs-gstreamer"; 18 + rev = "v${version}"; 19 + sha256 = "1fdpwr8br8x9cnrhr3j4f0l81df26n3bj2ibi3cg96rl86054nid"; 20 + }; 21 + 22 + nativeBuildInputs = [ pkg-config meson ninja ]; 23 + buildInputs = [ gst_all_1.gstreamermm obs-studio ]; 24 + 25 + meta = with lib; { 26 + description = "An OBS Studio source, encoder and video filter plugin to use GStreamer elements/pipelines in OBS Studio"; 27 + homepage = "https://github.com/fswoch/obs-gstreamer"; 28 + maintainers = with maintainers; [ ahuzik ]; 29 + license = licenses.gpl2Plus; 30 + platforms = [ "x86_64-linux" "i686-linux" ]; 31 + }; 32 + }
+31
pkgs/applications/video/obs-studio/plugins/obs-multi-rtmp.nix
···
··· 1 + { lib, stdenv, fetchFromGitHub, obs-studio, cmake, qtbase }: 2 + 3 + stdenv.mkDerivation rec { 4 + pname = "obs-multi-rtmp"; 5 + version = "0.2.6"; 6 + 7 + src = fetchFromGitHub { 8 + owner = "sorayuki"; 9 + repo = "obs-multi-rtmp"; 10 + rev = version; 11 + sha256 = "sha256-SMcVL54HwFIc7/wejEol2XiZhlZCMVCwHHtIKJ/CoYY="; 12 + }; 13 + 14 + nativeBuildInputs = [ cmake ]; 15 + buildInputs = [ obs-studio qtbase ]; 16 + 17 + cmakeFlags = [ 18 + "-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs" 19 + ]; 20 + 21 + dontWrapQtApps = true; 22 + 23 + meta = with lib; { 24 + homepage = "https://github.com/sorayuki/obs-multi-rtmp/"; 25 + changelog = "https://github.com/sorayuki/obs-multi-rtmp/releases/tag/${version}"; 26 + description = "Multi-site simultaneous broadcast plugin for OBS Studio"; 27 + license = licenses.gpl2Only; 28 + maintainers = with maintainers; [ jk ]; 29 + platforms = [ "x86_64-linux" "i686-linux" ]; 30 + }; 31 + }
+26
pkgs/applications/video/obs-studio/plugins/wlrobs.nix
···
··· 1 + { lib, stdenv, fetchhg 2 + , meson, pkg-config, ninja 3 + , wayland, obs-studio, libX11 4 + }: 5 + 6 + stdenv.mkDerivation { 7 + pname = "wlrobs"; 8 + version = "unstable-2021-05-13"; 9 + 10 + src = fetchhg { 11 + url = "https://hg.sr.ht/~scoopta/wlrobs"; 12 + rev = "4184a4a8ea7dc054c993efa16007f3a75b2c6f51"; 13 + sha256 = "146xirzd3nw1sd216y406v1riky9k08b6a0j4kwxrif5zyqa3adc"; 14 + }; 15 + 16 + nativeBuildInputs = [ meson pkg-config ninja ]; 17 + buildInputs = [ wayland obs-studio libX11 ]; 18 + 19 + meta = with lib; { 20 + description = "An obs-studio plugin that allows you to screen capture on wlroots based wayland compositors"; 21 + homepage = "https://hg.sr.ht/~scoopta/wlrobs"; 22 + maintainers = with maintainers; [ grahamc V ]; 23 + license = licenses.gpl3Plus; 24 + platforms = [ "x86_64-linux" ]; 25 + }; 26 + }
pkgs/applications/video/obs-studio/rename-obs-move-transition-cmake.patch pkgs/applications/video/obs-studio/plugins/rename-obs-move-transition-cmake.patch
-57
pkgs/applications/video/obs-studio/v4l2sink.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , fetchpatch 5 - , cmake 6 - , qtbase 7 - , obs-studio 8 - }: 9 - 10 - stdenv.mkDerivation rec { 11 - pname = "obs-v4l2sink"; 12 - version = "0.1.0-12-g1ec3c8a"; 13 - 14 - src = fetchFromGitHub { 15 - owner = "CatxFish"; 16 - repo = "obs-v4l2sink"; 17 - rev = version; 18 - sha256 = "03ah91cm1qz26k90mfx51l0d598i9bcmw39lkikjs1msm4c9dfxx"; 19 - }; 20 - 21 - nativeBuildInputs = [ cmake ]; 22 - buildInputs = [ qtbase obs-studio ]; 23 - 24 - dontWrapQtApps = true; 25 - 26 - patches = [ 27 - # Fixes the segfault when stopping the plugin 28 - (fetchpatch { 29 - url = "https://github.com/CatxFish/obs-v4l2sink/commit/6604f01796d1b84a95714730ea51a6b8ac0e450b.diff"; 30 - sha256 = "0crcvw02dj0aqy7hnhizjdsnhiw03zmg6cbdkasxz2mrrbyc3s88"; 31 - }) 32 - ]; 33 - 34 - cmakeFlags = with lib; [ 35 - "-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs" 36 - ]; 37 - 38 - # obs-studio expects the shared object to be located in bin/32bit or bin/64bit 39 - # https://github.com/obsproject/obs-studio/blob/d60c736cb0ec0491013293c8a483d3a6573165cb/libobs/obs-nix.c#L48 40 - postInstall = let 41 - pluginPath = { 42 - i686-linux = "bin/32bit"; 43 - x86_64-linux = "bin/64bit"; 44 - }.${stdenv.targetPlatform.system} or (throw "Unsupported system: ${stdenv.targetPlatform.system}"); 45 - in '' 46 - mkdir -p $out/share/obs/obs-plugins/v4l2sink/${pluginPath} 47 - ln -s $out/lib/obs-plugins/v4l2sink.so $out/share/obs/obs-plugins/v4l2sink/${pluginPath} 48 - ''; 49 - 50 - meta = with lib; { 51 - description = "obs studio output plugin for Video4Linux2 device"; 52 - homepage = "https://github.com/CatxFish/obs-v4l2sink"; 53 - maintainers = with maintainers; [ colemickens peelz ]; 54 - license = licenses.gpl2; 55 - platforms = [ "x86_64-linux" "i686-linux" ]; 56 - }; 57 - }
···
-42
pkgs/applications/video/obs-studio/wlrobs.nix
··· 1 - # (the following is somewhat lifted from ./linuxbrowser.nix) 2 - # We don't have a wrapper which can supply obs-studio plugins so you have to 3 - # somewhat manually install this: 4 - 5 - # nix-env -f . -iA obs-wlrobs 6 - # mkdir -p ~/.config/obs-studio/plugins/wlrobs/bin/64bit 7 - # ln -s ~/.nix-profile/share/obs/obs-plugins/wlrobs/bin/64bit/libwlrobs.so ~/.config/obs-studio/plugins/wlrobs/bin/64bit 8 - { stdenv, fetchhg, wayland, obs-studio 9 - , meson, ninja, pkg-config, libX11 10 - , dmabufSupport ? false, libdrm ? null, libGL ? null, lib}: 11 - 12 - assert dmabufSupport -> libdrm != null && libGL != null; 13 - 14 - stdenv.mkDerivation { 15 - pname = "obs-wlrobs"; 16 - version = "20200622"; 17 - 18 - src = fetchhg { 19 - url = "https://hg.sr.ht/~scoopta/wlrobs"; 20 - rev = "1d3acaaf64049da3da9721aa8b9b47582fe0081b"; 21 - sha256 = "0qrcf8024r4ynfjw0zx8vn59ygx9q5rb196s6nyxmy3gkv2lfxlq"; 22 - }; 23 - 24 - buildInputs = [ libX11 libGL libdrm meson ninja pkg-config wayland obs-studio ]; 25 - 26 - installPhase = '' 27 - mkdir -p $out/share/obs/obs-plugins/wlrobs/bin/64bit 28 - cp ./libwlrobs.so $out/share/obs/obs-plugins/wlrobs/bin/64bit/ 29 - ''; 30 - 31 - mesonFlags = [ 32 - "-Duse_dmabuf=${lib.boolToString dmabufSupport}" 33 - ]; 34 - 35 - meta = with lib; { 36 - description = "An obs-studio plugin that allows you to screen capture on wlroots based wayland compositors"; 37 - homepage = "https://hg.sr.ht/~scoopta/wlrobs"; 38 - maintainers = with maintainers; [ grahamc ]; 39 - license = licenses.gpl3; 40 - platforms = [ "x86_64-linux" ]; 41 - }; 42 - }
···
+21
pkgs/applications/video/obs-studio/wrapper.nix
···
··· 1 + { obs-studio, symlinkJoin, makeWrapper }: 2 + 3 + { plugins ? [] }: 4 + 5 + symlinkJoin { 6 + name = "wrapped-${obs-studio.name}"; 7 + 8 + nativeBuildInputs = [ makeWrapper ]; 9 + paths = [ obs-studio ] ++ plugins; 10 + 11 + postBuild = '' 12 + wrapProgram $out/bin/obs \ 13 + --set OBS_PLUGINS_PATH "$out/lib/obs-plugins" \ 14 + --set OBS_PLUGINS_DATA_PATH "$out/share/obs/obs-plugins" 15 + ''; 16 + 17 + inherit (obs-studio) meta; 18 + passthru = obs-studio.passthru // { 19 + passthru.unwrapped = obs-studio; 20 + }; 21 + }
+32
pkgs/top-level/aliases.nix
··· 1018 & maintenance is abandoned by upstream. 1019 ''; 1020 1021 /* If these are in the scope of all-packages.nix, they cause collisions 1022 between mixed versions of qt. See: 1023 https://github.com/NixOS/nixpkgs/pull/101369 */
··· 1018 & maintenance is abandoned by upstream. 1019 ''; 1020 1021 + # Added 2021-06-01 1022 + obs-gstreamer = throw '' 1023 + obs-gstreamer has been converted into a plugin for use with wrapOBS. 1024 + Its new location is obs-studio-plugins.obs-gstreamer. 1025 + ''; 1026 + 1027 + # Added 2021-06-01 1028 + obs-move-transition = throw '' 1029 + obs-move-transition has been converted into a plugin for use with wrapOBS. 1030 + Its new location is obs-studio-plugins.obs-move-transition. 1031 + ''; 1032 + 1033 + # Added 2021-06-01 1034 + obs-multi-rtmp = throw '' 1035 + obs-multi-rtmp has been converted into a plugin for use with wrapOBS. 1036 + Its new location is obs-studio-plugins.obs-multi-rtmp. 1037 + ''; 1038 + 1039 + # Added 2021-06-01 1040 + obs-ndi = throw '' 1041 + obs-ndi has been converted into a plugin for use with wrapOBS. 1042 + Its new location is obs-studio-plugins.obs-ndi. 1043 + ''; 1044 + 1045 + obs-v4l2sink = throw "obs-v4l2sink is integrated into upstream OBS since version 26.1"; # Added 2021-06-01 1046 + 1047 + # Added 2021-06-01 1048 + obs-wlrobs = throw '' 1049 + wlrobs has been converted into a plugin for use with wrapOBS. 1050 + Its new location is obs-studio-plugins.wlrobs. 1051 + ''; 1052 + 1053 /* If these are in the scope of all-packages.nix, they cause collisions 1054 between mixed versions of qt. See: 1055 https://github.com/NixOS/nixpkgs/pull/101369 */
+3 -13
pkgs/top-level/all-packages.nix
··· 25819 25820 oberon-risc-emu = callPackage ../misc/emulators/oberon-risc-emu { }; 25821 25822 - obs-studio = libsForQt5.callPackage ../applications/video/obs-studio { }; 25823 - 25824 - obs-wlrobs = callPackage ../applications/video/obs-studio/wlrobs.nix { }; 25825 - 25826 - obs-gstreamer = callPackage ../applications/video/obs-studio/obs-gstreamer.nix { }; 25827 - 25828 - obs-move-transition = callPackage ../applications/video/obs-studio/obs-move-transition.nix { }; 25829 - 25830 - obs-multi-rtmp = libsForQt5.callPackage ../applications/video/obs-studio/obs-multi-rtmp.nix { }; 25831 - 25832 - obs-v4l2sink = libsForQt5.callPackage ../applications/video/obs-studio/v4l2sink.nix { }; 25833 - 25834 - obs-ndi = libsForQt5.callPackage ../applications/video/obs-studio/obs-ndi.nix { }; 25835 25836 obsidian = callPackage ../applications/misc/obsidian { }; 25837
··· 25819 25820 oberon-risc-emu = callPackage ../misc/emulators/oberon-risc-emu { }; 25821 25822 + obs-studio = libsForQt5.callPackage ../applications/video/obs-studio {}; 25823 + obs-studio-plugins = callPackage ../applications/video/obs-studio/plugins {}; 25824 + wrapOBS = callPackage ../applications/video/obs-studio/wrapper.nix {}; 25825 25826 obsidian = callPackage ../applications/misc/obsidian { }; 25827