21 stdenv.mkDerivation (finalAttrs: {
22 pname = "obs-vkcapture";
25 src = fetchFromGitHub {
27 repo = "obs-vkcapture";
28 rev = "v${finalAttrs.version}";
29 hash = "sha256-RIDsT6eL6bUfqPiyPlecnZHu5OorcJb3Xal8pjdOpAA=";
32 cmakeFlags = lib.optionals stdenv.hostPlatform.isi686 [
33 # We don't want to build the plugin for 32bit. The library integrates with
34 # the 64bit plugin but it's necessary to be loaded into 32bit games.
38 nativeBuildInputs = [ cmake ninja pkg-config wayland-scanner ];
50 ++ lib.optionals (!stdenv.hostPlatform.isi686) [
55 substituteInPlace src/glinject.c \
56 --replace "libGLX.so.0" "${lib.getLib libGL}/lib/libGLX.so.0" \
57 --replace "libX11.so.6" "${lib.getLib libX11}/lib/libX11.so.6" \
58 --replace "libX11-xcb.so.1" "${lib.getLib libX11}/lib/libX11-xcb.so.1" \
59 --replace "libxcb-dri3.so.0" "${lib.getLib libxcb}/lib/libxcb-dri3.so.0" \
60 --replace "libEGL.so.1" "${lib.getLib libGL}/lib/libEGL.so.1" \
61 --replace "libvulkan.so.1" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1"
64 # Support 32bit Vulkan applications by linking in the 32bit Vulkan layer and
65 # the wrapper executables. Note that vkcapture and glcapture are themselves
66 # wrapper scripts that simply exec gamecapture and print a warning but because
67 # they take gamecapture from PATH, we must link them to the 32 bit gamecapture
69 postInstall = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
70 ln -s ${obs-vkcapture32}/share/vulkan/implicit_layer.d/obs_vkcapture_32.json \
71 "$out/share/vulkan/implicit_layer.d/"
72 for bin in ${obs-vkcapture32}/bin/* ; do
73 ln -s ${obs-vkcapture32}/bin/obs-gamecapture "$out/bin/$(basename "$bin")32"
78 description = "OBS Linux Vulkan/OpenGL game capture";
79 homepage = "https://github.com/nowrep/obs-vkcapture";
80 changelog = "https://github.com/nowrep/obs-vkcapture/releases/tag/v${finalAttrs.version}";
81 maintainers = with maintainers; [ atila pedrohlc ];
82 license = licenses.gpl2Only;
83 platforms = platforms.linux;