nixpkgs/pkgs/applications/video/obs-studio/default.nix

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

207 lines
4.7 KiB
Nix
Raw Normal View History

2022-11-11 14:28:56 +00:00
{ config
2021-08-10 20:34:42 +00:00
, lib
, stdenv
2015-11-19 01:03:35 +00:00
, fetchFromGitHub
, fetchpatch
, addOpenGLRunpath
, cmake
, fdk_aac
, ffmpeg
, jansson
, libjack2
, libxkbcommon
, libpthreadstubs
, libXdmcp
2015-12-20 02:15:34 +00:00
, qtbase
2019-05-03 18:17:14 +00:00
, qtsvg
, speex
, libv4l
, x264
, curl
, wayland
, xorg
, pkg-config
2020-09-25 15:50:44 +00:00
, libvlc
2023-08-02 10:36:31 +00:00
, libGL
2018-09-23 01:04:04 +00:00
, mbedtls
, wrapGAppsHook3
, scriptingSupport ? true
, luajit
, swig4
, python3
, alsaSupport ? stdenv.isLinux
, alsa-lib
, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux
2015-06-25 06:47:44 +00:00
, libpulseaudio
, libcef
2021-12-30 12:57:33 +00:00
, pciutils
, pipewireSupport ? stdenv.isLinux
, withFdk ? true
, pipewire
2021-11-28 17:07:46 +00:00
, libdrm
2022-11-11 14:28:56 +00:00
, libajantv2
, librist
, libva
2022-11-11 14:28:56 +00:00
, srt
, qtwayland
, wrapQtAppsHook
, nlohmann_json
, websocketpp
, asio
, decklinkSupport ? false
, blackmagic-desktop-video
, libdatachannel
, libvpl
, qrcodegencpp
, nix-update-script
}:
2015-06-25 06:47:44 +00:00
let
2021-01-15 05:42:41 +00:00
inherit (lib) optional optionals;
2021-08-10 20:34:42 +00:00
in
2023-12-20 01:46:22 +00:00
stdenv.mkDerivation (finalAttrs: {
pname = "obs-studio";
2024-04-07 08:17:12 +00:00
version = "30.1.2";
2015-11-19 01:03:35 +00:00
src = fetchFromGitHub {
owner = "obsproject";
2023-12-20 01:46:22 +00:00
repo = finalAttrs.pname;
rev = finalAttrs.version;
2024-04-07 08:17:12 +00:00
sha256 = "sha256-M4IINBoYrgkM37ykb4boHyWP8AxwMX0b7IAeeNIw9Qo=";
fetchSubmodules = true;
};
patches = [
# Lets obs-browser build against CEF 90.1.0+
./Enable-file-access-and-universal-access-for-file-URL.patch
./fix-nix-plugin-path.patch
# Fix libobs.pc for plugins on non-x86 systems
(fetchpatch {
name = "fix-arm64-cmake.patch";
url = "https://git.alpinelinux.org/aports/plain/community/obs-studio/broken-config.patch?id=a92887564dcc65e07b6be8a6224fda730259ae2b";
hash = "sha256-yRSw4VWDwMwysDB3Hw/tsmTjEQUhipvrVRQcZkbtuoI=";
includes = [ "*/CompilerConfig.cmake" ];
})
2022-11-11 14:28:56 +00:00
];
2021-08-10 20:34:42 +00:00
nativeBuildInputs = [
addOpenGLRunpath
cmake
pkg-config
wrapGAppsHook3
wrapQtAppsHook
2021-08-10 20:34:42 +00:00
]
++ optional scriptingSupport swig4;
2015-11-19 01:03:35 +00:00
buildInputs = [
curl
ffmpeg
jansson
libcef
libjack2
libv4l
libxkbcommon
libpthreadstubs
libXdmcp
qtbase
qtsvg
speex
wayland
x264
2020-09-25 15:50:44 +00:00
libvlc
mbedtls
2021-12-30 12:57:33 +00:00
pciutils
2022-11-11 14:28:56 +00:00
libajantv2
librist
libva
2022-11-11 14:28:56 +00:00
srt
qtwayland
nlohmann_json
websocketpp
asio
libdatachannel
libvpl
qrcodegencpp
]
2021-08-10 20:34:42 +00:00
++ 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
2023-10-05 16:16:37 +00:00
ln -s $i cef/Release/
ln -s $i cef/Resources/
done
2023-10-05 16:16:37 +00:00
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/
'';
cmakeFlags = [
2023-12-20 01:46:22 +00:00
"-DOBS_VERSION_OVERRIDE=${finalAttrs.version}"
"-Wno-dev" # kill dev warnings that are useless for packaging
# Add support for browser source
"-DBUILD_BROWSER=ON"
"-DCEF_ROOT_DIR=../../cef"
2022-11-11 14:28:56 +00:00
"-DENABLE_JACK=ON"
(lib.cmakeBool "ENABLE_QSV11" stdenv.hostPlatform.isx86_64)
(lib.cmakeBool "ENABLE_LIBFDK" withFdk)
(lib.cmakeBool "ENABLE_ALSA" alsaSupport)
(lib.cmakeBool "ENABLE_PULSEAUDIO" pulseaudioSupport)
(lib.cmakeBool "ENABLE_PIPEWIRE" pipewireSupport)
2022-11-11 14:28:56 +00:00
];
2024-03-13 17:33:54 +00:00
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=sign-compare" # https://github.com/obsproject/obs-studio/issues/10200
];
dontWrapGApps = true;
preFixup = let
wrapperLibraries = [
xorg.libX11
libvlc
libGL
] ++ optionals decklinkSupport [
blackmagic-desktop-video
];
in ''
2023-10-08 15:36:15 +00:00
# Remove libcef before patchelf, otherwise it will fail
2023-10-08 15:38:15 +00:00
rm $out/lib/obs-plugins/libcef.so
2023-10-05 16:16:37 +00:00
qtWrapperArgs+=(
--prefix LD_LIBRARY_PATH : "$out/lib:${lib.makeLibraryPath wrapperLibraries}"
''${gappsWrapperArgs[@]}
)
'';
2021-01-15 05:42:41 +00:00
postFixup = lib.optionalString stdenv.isLinux ''
addOpenGLRunpath $out/lib/lib*.so
addOpenGLRunpath $out/lib/obs-plugins/*.so
2023-10-05 16:16:37 +00:00
2023-10-08 15:36:15 +00:00
# Link libcef again after patchelfing other libs
ln -s ${libcef}/lib/* $out/lib/obs-plugins/
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Free and open source software for video recording and live streaming";
longDescription = ''
This project is a rewrite of what was formerly known as "Open Broadcaster
Software", software originally designed for recording and streaming live
video content, efficiently
'';
2020-03-19 12:55:37 +00:00
homepage = "https://obsproject.com";
maintainers = with maintainers; [ eclairevoyant jb55 materus fpletz ];
license = with licenses; [ gpl2Plus ] ++ optional withFdk fraunhofer-fdk;
2021-08-10 20:34:42 +00:00
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
2022-02-16 22:14:51 +00:00
mainProgram = "obs";
};
2023-12-20 01:46:22 +00:00
})