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
|
2024-01-08 11:54:00 +00:00
|
|
|
, fetchpatch
|
2020-04-28 14:04:41 +00:00
|
|
|
, addOpenGLRunpath
|
2015-03-30 07:10:29 +00:00
|
|
|
, cmake
|
2017-05-04 22:14:59 +00:00
|
|
|
, fdk_aac
|
2024-01-08 11:54:00 +00:00
|
|
|
, ffmpeg
|
2015-03-30 07:10:29 +00:00
|
|
|
, jansson
|
2017-10-24 21:09:33 +00:00
|
|
|
, libjack2
|
2015-03-30 07:10:29 +00:00
|
|
|
, libxkbcommon
|
2017-05-04 22:14:59 +00:00
|
|
|
, libpthreadstubs
|
|
|
|
, libXdmcp
|
2015-12-20 02:15:34 +00:00
|
|
|
, qtbase
|
2019-05-03 18:17:14 +00:00
|
|
|
, qtsvg
|
2017-10-24 21:09:33 +00:00
|
|
|
, speex
|
2015-03-30 07:10:29 +00:00
|
|
|
, libv4l
|
|
|
|
, x264
|
2015-07-16 20:10:16 +00:00
|
|
|
, curl
|
2021-03-18 12:27:51 +00:00
|
|
|
, wayland
|
2016-07-25 02:19:32 +00:00
|
|
|
, xorg
|
2021-01-17 02:09:27 +00:00
|
|
|
, 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
|
2024-04-26 20:24:03 +00:00
|
|
|
, wrapGAppsHook3
|
2019-01-10 21:58:20 +00:00
|
|
|
, scriptingSupport ? true
|
|
|
|
, luajit
|
2023-07-11 11:09:23 +00:00
|
|
|
, swig4
|
2019-01-10 21:58:20 +00:00
|
|
|
, python3
|
2019-02-03 15:33:18 +00:00
|
|
|
, alsaSupport ? stdenv.isLinux
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib
|
2019-02-03 15:33:18 +00:00
|
|
|
, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux
|
2015-06-25 06:47:44 +00:00
|
|
|
, libpulseaudio
|
2020-10-01 14:43:16 +00:00
|
|
|
, libcef
|
2021-12-30 12:57:33 +00:00
|
|
|
, pciutils
|
2021-04-02 19:22:12 +00:00
|
|
|
, pipewireSupport ? stdenv.isLinux
|
2024-01-01 20:01:34 +00:00
|
|
|
, withFdk ? true
|
2021-04-02 19:22:12 +00:00
|
|
|
, pipewire
|
2021-11-28 17:07:46 +00:00
|
|
|
, libdrm
|
2022-11-11 14:28:56 +00:00
|
|
|
, libajantv2
|
|
|
|
, librist
|
2023-01-08 12:00:02 +00:00
|
|
|
, libva
|
2022-11-11 14:28:56 +00:00
|
|
|
, srt
|
|
|
|
, qtwayland
|
2022-10-05 10:36:25 +00:00
|
|
|
, wrapQtAppsHook
|
2023-07-11 11:09:23 +00:00
|
|
|
, nlohmann_json
|
|
|
|
, websocketpp
|
|
|
|
, asio
|
2023-08-04 12:50:44 +00:00
|
|
|
, decklinkSupport ? false
|
|
|
|
, blackmagic-desktop-video
|
2023-11-21 17:28:18 +00:00
|
|
|
, libdatachannel
|
|
|
|
, libvpl
|
|
|
|
, qrcodegencpp
|
2024-03-13 17:38:04 +00:00
|
|
|
, nix-update-script
|
2015-03-30 07:10:29 +00:00
|
|
|
}:
|
|
|
|
|
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: {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "obs-studio";
|
2024-04-07 08:17:12 +00:00
|
|
|
version = "30.1.2";
|
2015-03-30 07:10:29 +00:00
|
|
|
|
2015-11-19 01:03:35 +00:00
|
|
|
src = fetchFromGitHub {
|
2020-01-22 11:51:51 +00:00
|
|
|
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=";
|
2020-10-01 14:43:16 +00:00
|
|
|
fetchSubmodules = true;
|
2015-03-30 07:10:29 +00:00
|
|
|
};
|
|
|
|
|
2021-06-10 17:18:46 +00:00
|
|
|
patches = [
|
|
|
|
# Lets obs-browser build against CEF 90.1.0+
|
|
|
|
./Enable-file-access-and-universal-access-for-file-URL.patch
|
2023-07-11 11:09:23 +00:00
|
|
|
./fix-nix-plugin-path.patch
|
2024-01-08 11:54:00 +00:00
|
|
|
|
2023-12-15 01:20:46 +00:00
|
|
|
# Fix libobs.pc for plugins on non-x86 systems
|
2024-01-20 17:10:54 +00:00
|
|
|
(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-06-10 17:18:46 +00:00
|
|
|
|
2021-08-10 20:34:42 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
addOpenGLRunpath
|
|
|
|
cmake
|
|
|
|
pkg-config
|
2024-04-26 20:24:03 +00:00
|
|
|
wrapGAppsHook3
|
2022-10-05 10:36:25 +00:00
|
|
|
wrapQtAppsHook
|
2021-08-10 20:34:42 +00:00
|
|
|
]
|
2023-07-11 11:09:23 +00:00
|
|
|
++ optional scriptingSupport swig4;
|
2015-11-19 01:03:35 +00:00
|
|
|
|
2020-05-21 12:52:32 +00:00
|
|
|
buildInputs = [
|
|
|
|
curl
|
2024-01-08 11:54:00 +00:00
|
|
|
ffmpeg
|
2020-05-21 12:52:32 +00:00
|
|
|
jansson
|
2020-10-01 14:43:16 +00:00
|
|
|
libcef
|
2020-05-21 12:52:32 +00:00
|
|
|
libjack2
|
|
|
|
libv4l
|
|
|
|
libxkbcommon
|
|
|
|
libpthreadstubs
|
|
|
|
libXdmcp
|
|
|
|
qtbase
|
|
|
|
qtsvg
|
|
|
|
speex
|
2021-03-18 12:27:51 +00:00
|
|
|
wayland
|
2020-05-21 12:52:32 +00:00
|
|
|
x264
|
2020-09-25 15:50:44 +00:00
|
|
|
libvlc
|
2020-05-21 12:52:32 +00:00
|
|
|
mbedtls
|
2021-12-30 12:57:33 +00:00
|
|
|
pciutils
|
2022-11-11 14:28:56 +00:00
|
|
|
libajantv2
|
|
|
|
librist
|
2023-01-08 12:00:02 +00:00
|
|
|
libva
|
2022-11-11 14:28:56 +00:00
|
|
|
srt
|
|
|
|
qtwayland
|
2023-07-11 11:09:23 +00:00
|
|
|
nlohmann_json
|
|
|
|
websocketpp
|
|
|
|
asio
|
2023-11-21 17:28:18 +00:00
|
|
|
libdatachannel
|
|
|
|
libvpl
|
|
|
|
qrcodegencpp
|
2020-05-21 12:52:32 +00:00
|
|
|
]
|
2021-08-10 20:34:42 +00:00
|
|
|
++ optionals scriptingSupport [ luajit python3 ]
|
2021-06-10 02:57:09 +00:00
|
|
|
++ optional alsaSupport alsa-lib
|
2021-04-02 19:22:12 +00:00
|
|
|
++ optional pulseaudioSupport libpulseaudio
|
2024-01-01 20:01:34 +00:00
|
|
|
++ optionals pipewireSupport [ pipewire libdrm ]
|
|
|
|
++ optional withFdk fdk_aac;
|
2015-03-30 07:10:29 +00:00
|
|
|
|
2020-10-01 14:43:16 +00:00
|
|
|
# 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/
|
2020-10-01 14:43:16 +00:00
|
|
|
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/
|
2020-10-01 14:43:16 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-21 12:52:32 +00:00
|
|
|
cmakeFlags = [
|
2023-12-20 01:46:22 +00:00
|
|
|
"-DOBS_VERSION_OVERRIDE=${finalAttrs.version}"
|
2020-05-21 12:52:32 +00:00
|
|
|
"-Wno-dev" # kill dev warnings that are useless for packaging
|
2020-10-01 14:43:16 +00:00
|
|
|
# Add support for browser source
|
|
|
|
"-DBUILD_BROWSER=ON"
|
|
|
|
"-DCEF_ROOT_DIR=../../cef"
|
2022-11-11 14:28:56 +00:00
|
|
|
"-DENABLE_JACK=ON"
|
2024-01-10 19:43:05 +00:00
|
|
|
(lib.cmakeBool "ENABLE_QSV11" stdenv.hostPlatform.isx86_64)
|
2024-01-01 20:01:34 +00:00
|
|
|
(lib.cmakeBool "ENABLE_LIBFDK" withFdk)
|
2023-12-11 15:29:54 +00:00
|
|
|
(lib.cmakeBool "ENABLE_ALSA" alsaSupport)
|
|
|
|
(lib.cmakeBool "ENABLE_PULSEAUDIO" pulseaudioSupport)
|
|
|
|
(lib.cmakeBool "ENABLE_PIPEWIRE" pipewireSupport)
|
2022-11-11 14:28:56 +00:00
|
|
|
];
|
2015-03-30 07:10:29 +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
|
|
|
|
];
|
|
|
|
|
2021-11-14 09:14:39 +00:00
|
|
|
dontWrapGApps = true;
|
2023-08-04 12:50:44 +00:00
|
|
|
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
|
|
|
|
2021-11-14 09:14:39 +00:00
|
|
|
qtWrapperArgs+=(
|
2023-08-04 12:50:44 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "$out/lib:${lib.makeLibraryPath wrapperLibraries}"
|
2021-11-14 09:14:39 +00:00
|
|
|
''${gappsWrapperArgs[@]}
|
|
|
|
)
|
|
|
|
'';
|
2016-07-25 02:19:32 +00:00
|
|
|
|
2021-01-15 05:42:41 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
2021-06-17 18:05:26 +00:00
|
|
|
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
|
2023-11-21 17:28:18 +00:00
|
|
|
ln -s ${libcef}/lib/* $out/lib/obs-plugins/
|
2020-04-28 14:04:41 +00:00
|
|
|
'';
|
|
|
|
|
2024-03-13 17:38:04 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2015-03-30 07:10:29 +00:00
|
|
|
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";
|
2024-04-28 23:24:09 +00:00
|
|
|
maintainers = with maintainers; [ eclairevoyant jb55 materus fpletz ];
|
2024-01-01 20:01:34 +00:00
|
|
|
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";
|
2015-03-30 07:10:29 +00:00
|
|
|
};
|
2023-12-20 01:46:22 +00:00
|
|
|
})
|