2022-04-27 09:35:20 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2022-09-09 14:08:57 +00:00
|
|
|
, extra-cmake-modules
|
2022-04-27 09:35:20 +00:00
|
|
|
, ninja
|
|
|
|
, wayland
|
2022-09-09 14:08:57 +00:00
|
|
|
, wayland-scanner
|
2022-04-27 09:35:20 +00:00
|
|
|
, obs-studio
|
2023-04-29 16:46:19 +00:00
|
|
|
, libffi
|
2022-04-27 09:35:20 +00:00
|
|
|
, libX11
|
2023-04-29 16:46:19 +00:00
|
|
|
, libXau
|
|
|
|
, libXdmcp
|
2023-02-22 10:55:15 +00:00
|
|
|
, libxcb
|
2022-04-27 09:35:20 +00:00
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
|
|
|
, libGL
|
2022-09-09 14:08:57 +00:00
|
|
|
, obs-vkcapture32
|
2022-04-27 09:35:20 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-04-27 09:35:20 +00:00
|
|
|
pname = "obs-vkcapture";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.5.0";
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nowrep";
|
2023-07-15 17:15:38 +00:00
|
|
|
repo = finalAttrs.pname;
|
|
|
|
rev = "v${finalAttrs.version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-hYPQ1N4k4eb+bvGWZqaQJ/C8C5Lh8ooZ03raGF5ORgE=";
|
2022-04-27 09:35:20 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
cmakeFlags = lib.optionals stdenv.isi686 [
|
|
|
|
# We don't want to build the plugin for 32bit. The library integrates with
|
|
|
|
# the 64bit plugin but it's necessary to be loaded into 32bit games.
|
|
|
|
"-DBUILD_PLUGIN=OFF"
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake extra-cmake-modules ninja wayland-scanner ];
|
|
|
|
buildInputs = [
|
|
|
|
libGL
|
2023-04-29 16:46:19 +00:00
|
|
|
libffi
|
2022-09-09 14:08:57 +00:00
|
|
|
libX11
|
2023-04-29 16:46:19 +00:00
|
|
|
libXau
|
|
|
|
libXdmcp
|
2023-02-22 10:55:15 +00:00
|
|
|
libxcb
|
2022-09-09 14:08:57 +00:00
|
|
|
vulkan-headers
|
|
|
|
vulkan-loader
|
|
|
|
wayland
|
|
|
|
]
|
|
|
|
++ lib.optionals (!stdenv.isi686) [
|
|
|
|
obs-studio
|
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/glinject.c \
|
|
|
|
--replace "libGLX.so.0" "${lib.getLib libGL}/lib/libGLX.so.0" \
|
|
|
|
--replace "libX11.so.6" "${lib.getLib libX11}/lib/libX11.so.6" \
|
|
|
|
--replace "libX11-xcb.so.1" "${lib.getLib libX11}/lib/libX11-xcb.so.1" \
|
|
|
|
--replace "libxcb-dri3.so.0" "${lib.getLib libxcb}/lib/libxcb-dri3.so.0" \
|
|
|
|
--replace "libEGL.so.1" "${lib.getLib libGL}/lib/libEGL.so.1" \
|
|
|
|
--replace "libvulkan.so.1" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1"
|
|
|
|
'';
|
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
# Support 32bit Vulkan applications by linking in the 32bit Vulkan layer and
|
|
|
|
# the wrapper executables. Note that vkcapture and glcapture are themselves
|
|
|
|
# wrapper scripts that simply exec gamecapture and print a warning but because
|
|
|
|
# they take gamecapture from PATH, we must link them to the 32 bit gamecapture
|
|
|
|
# directly.
|
2022-09-09 14:08:57 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
|
|
|
|
ln -s ${obs-vkcapture32}/share/vulkan/implicit_layer.d/obs_vkcapture_32.json \
|
|
|
|
"$out/share/vulkan/implicit_layer.d/"
|
2024-07-01 15:47:52 +00:00
|
|
|
for bin in ${obs-vkcapture32}/bin/* ; do
|
|
|
|
ln -s ${obs-vkcapture32}/bin/obs-gamecapture "$out/bin/$(basename "$bin")32"
|
|
|
|
done
|
2022-09-09 14:08:57 +00:00
|
|
|
'';
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "OBS Linux Vulkan/OpenGL game capture";
|
|
|
|
homepage = "https://github.com/nowrep/obs-vkcapture";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/nowrep/obs-vkcapture/releases/tag/v${finalAttrs.version}";
|
2022-09-09 14:08:57 +00:00
|
|
|
maintainers = with maintainers; [ atila pedrohlc ];
|
2022-04-27 09:35:20 +00:00
|
|
|
license = licenses.gpl2Only;
|
2022-08-12 12:06:08 +00:00
|
|
|
platforms = platforms.linux;
|
2022-04-27 09:35:20 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|