diff --git a/pkgs/applications/video/obs-studio/default.nix b/pkgs/applications/video/obs-studio/default.nix index 418d9adf8263b..8643e13ad851c 100644 --- a/pkgs/applications/video/obs-studio/default.nix +++ b/pkgs/applications/video/obs-studio/default.nix @@ -1,63 +1,73 @@ -{ config -, lib -, stdenv -, fetchFromGitHub -, fetchpatch -, addOpenGLRunpath -, cmake -, fdk_aac -, ffmpeg -, jansson -, libjack2 -, libxkbcommon -, libpthreadstubs -, libXdmcp -, qtbase -, qtsvg -, speex -, libv4l -, x264 -, curl -, wayland -, xorg -, pkg-config -, libvlc -, libGL -, mbedtls -, wrapGAppsHook3 -, scriptingSupport ? true -, luajit -, swig4 -, python3 -, alsaSupport ? stdenv.isLinux -, alsa-lib -, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux -, libpulseaudio -, libcef -, pciutils -, pipewireSupport ? stdenv.isLinux -, withFdk ? true -, pipewire -, libdrm -, libajantv2 -, librist -, libva -, srt -, qtwayland -, wrapQtAppsHook -, nlohmann_json -, websocketpp -, asio -, decklinkSupport ? false -, blackmagic-desktop-video -, libdatachannel -, libvpl -, qrcodegencpp -, nix-update-script +{ + config, + lib, + stdenv, + fetchurl, + fetchFromGitHub, + fetchpatch, + addOpenGLRunpath, + cmake, + fdk_aac, + ffmpeg, + jansson, + libjack2, + libxkbcommon, + libpthreadstubs, + libXdmcp, + qtbase, + qtsvg, + speex, + libv4l, + x264, + curl, + wayland, + xorg, + pkg-config, + libvlc, + libGL, + mbedtls, + wrapGAppsHook3, + scriptingSupport ? true, + luajit, + swig4, + python3, + alsaSupport ? stdenv.isLinux, + alsa-lib, + pulseaudioSupport ? config.pulseaudio or stdenv.isLinux, + libpulseaudio, + libcef, + pciutils, + pipewireSupport ? stdenv.isLinux, + withFdk ? true, + pipewire, + libdrm, + libajantv2, + librist, + libva, + srt, + qtwayland, + wrapQtAppsHook, + nlohmann_json, + websocketpp, + asio, + decklinkSupport ? false, + blackmagic-desktop-video, + libdatachannel, + libvpl, + qrcodegencpp, + nix-update-script, }: let inherit (lib) optional optionals; + libcef_obs = libcef.overrideAttrs (_: { + version = "5060"; + src = fetchurl { + url = "https://cdn-fastly.obsproject.com/downloads/cef_binary_5060_linux_x86_64_v3.tar.xz"; + hash = "sha256-ElOmo2w7isW17Om/226uardeSVFjdfxHXi6HF5Wtm+o=1"; + }; + postUnpack = "rm -r */build"; + }); in stdenv.mkDerivation (finalAttrs: { @@ -92,55 +102,61 @@ stdenv.mkDerivation (finalAttrs: { pkg-config wrapGAppsHook3 wrapQtAppsHook - ] - ++ optional scriptingSupport swig4; - - buildInputs = [ - curl - ffmpeg - jansson - libcef - libjack2 - libv4l - libxkbcommon - libpthreadstubs - libXdmcp - qtbase - qtsvg - speex - wayland - x264 - libvlc - mbedtls - pciutils - libajantv2 - librist - libva - srt - qtwayland - nlohmann_json - websocketpp - asio - libdatachannel - libvpl - qrcodegencpp - ] - ++ optionals scriptingSupport [ luajit python3 ] - ++ optional alsaSupport alsa-lib - ++ optional pulseaudioSupport libpulseaudio - ++ optionals pipewireSupport [ pipewire libdrm ] - ++ optional withFdk fdk_aac; + ] ++ optional scriptingSupport swig4; + + buildInputs = + [ + curl + ffmpeg + jansson + libcef_obs + libjack2 + libv4l + libxkbcommon + libpthreadstubs + libXdmcp + qtbase + qtsvg + speex + wayland + x264 + libvlc + mbedtls + pciutils + libajantv2 + librist + libva + srt + qtwayland + nlohmann_json + websocketpp + asio + libdatachannel + libvpl + qrcodegencpp + ] + ++ optionals scriptingSupport [ + luajit + python3 + ] + ++ optional alsaSupport alsa-lib + ++ optional pulseaudioSupport libpulseaudio + ++ optionals pipewireSupport [ + pipewire + libdrm + ] + ++ optional withFdk fdk_aac; # Copied from the obs-linuxbrowser postUnpack = '' mkdir -p cef/Release cef/Resources cef/libcef_dll_wrapper/ - for i in ${libcef}/share/cef/*; do + for i in ${libcef_obs}/share/cef/*; do ln -s $i cef/Release/ ln -s $i cef/Resources/ done - ln -s ${libcef}/lib/libcef.so cef/Release/ - ln -s ${libcef}/lib/libcef_dll_wrapper.a cef/libcef_dll_wrapper/ - ln -s ${libcef}/include cef/ + ln -s ${libcef_obs}/lib/libcef.so cef/Release/ + ln -s ${libcef_obs}/lib/libcef_dll_wrapper.a cef/libcef_dll_wrapper/ + ln -s ${libcef_obs}/include cef/ ''; cmakeFlags = [ @@ -162,30 +178,30 @@ stdenv.mkDerivation (finalAttrs: { ]; dontWrapGApps = true; - preFixup = let - wrapperLibraries = [ - xorg.libX11 - libvlc - libGL - ] ++ optionals decklinkSupport [ - blackmagic-desktop-video - ]; - in '' - # Remove libcef before patchelf, otherwise it will fail - rm $out/lib/obs-plugins/libcef.so - - qtWrapperArgs+=( - --prefix LD_LIBRARY_PATH : "$out/lib:${lib.makeLibraryPath wrapperLibraries}" - ''${gappsWrapperArgs[@]} - ) - ''; + preFixup = + let + wrapperLibraries = [ + xorg.libX11 + libvlc + libGL + ] ++ optionals decklinkSupport [ blackmagic-desktop-video ]; + in + '' + # Remove libcef before patchelf, otherwise it will fail + rm $out/lib/obs-plugins/libcef.so + + qtWrapperArgs+=( + --prefix LD_LIBRARY_PATH : "$out/lib:${lib.makeLibraryPath wrapperLibraries}" + ''${gappsWrapperArgs[@]} + ) + ''; postFixup = lib.optionalString stdenv.isLinux '' addOpenGLRunpath $out/lib/lib*.so addOpenGLRunpath $out/lib/obs-plugins/*.so # Link libcef again after patchelfing other libs - ln -s ${libcef}/lib/* $out/lib/obs-plugins/ + ln -s ${libcef_obs}/lib/* $out/lib/obs-plugins/ ''; passthru.updateScript = nix-update-script { }; @@ -198,9 +214,18 @@ stdenv.mkDerivation (finalAttrs: { video content, efficiently ''; homepage = "https://obsproject.com"; - maintainers = with maintainers; [ eclairevoyant jb55 materus fpletz ]; + maintainers = with maintainers; [ + eclairevoyant + jb55 + materus + fpletz + ]; license = with licenses; [ gpl2Plus ] ++ optional withFdk fraunhofer-fdk; - platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ]; + platforms = [ + "x86_64-linux" + "i686-linux" + "aarch64-linux" + ]; mainProgram = "obs"; }; })