Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 94 lines 2.6 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 pkg-config, 7 ninja, 8 wayland, 9 wayland-scanner, 10 obs-studio, 11 libffi, 12 libX11, 13 libXau, 14 libXdmcp, 15 libxcb, 16 vulkan-headers, 17 vulkan-loader, 18 libGL, 19 obs-vkcapture32, 20}: 21 22stdenv.mkDerivation (finalAttrs: { 23 pname = "obs-vkcapture"; 24 version = "1.5.2"; 25 26 src = fetchFromGitHub { 27 owner = "nowrep"; 28 repo = "obs-vkcapture"; 29 rev = "v${finalAttrs.version}"; 30 hash = "sha256-ghfRST7J3bipQnOZnYMtmDggET+Etq/ngHs+zQ0bm1w="; 31 }; 32 33 cmakeFlags = lib.optionals stdenv.hostPlatform.isi686 [ 34 # We don't want to build the plugin for 32bit. The library integrates with 35 # the 64bit plugin but it's necessary to be loaded into 32bit games. 36 "-DBUILD_PLUGIN=OFF" 37 ]; 38 39 nativeBuildInputs = [ 40 cmake 41 ninja 42 pkg-config 43 wayland-scanner 44 ]; 45 buildInputs = [ 46 libGL 47 libffi 48 libX11 49 libXau 50 libXdmcp 51 libxcb 52 vulkan-headers 53 vulkan-loader 54 wayland 55 ] 56 ++ lib.optionals (!stdenv.hostPlatform.isi686) [ 57 obs-studio 58 ]; 59 60 postPatch = '' 61 substituteInPlace src/glinject.c \ 62 --replace "libGLX.so.0" "${lib.getLib libGL}/lib/libGLX.so.0" \ 63 --replace "libX11.so.6" "${lib.getLib libX11}/lib/libX11.so.6" \ 64 --replace "libX11-xcb.so.1" "${lib.getLib libX11}/lib/libX11-xcb.so.1" \ 65 --replace "libxcb-dri3.so.0" "${lib.getLib libxcb}/lib/libxcb-dri3.so.0" \ 66 --replace "libEGL.so.1" "${lib.getLib libGL}/lib/libEGL.so.1" \ 67 --replace "libvulkan.so.1" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1" 68 ''; 69 70 # Support 32bit Vulkan applications by linking in the 32bit Vulkan layer and 71 # the wrapper executables. Note that vkcapture and glcapture are themselves 72 # wrapper scripts that simply exec gamecapture and print a warning but because 73 # they take gamecapture from PATH, we must link them to the 32 bit gamecapture 74 # directly. 75 postInstall = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") '' 76 ln -s ${obs-vkcapture32}/share/vulkan/implicit_layer.d/obs_vkcapture_32.json \ 77 "$out/share/vulkan/implicit_layer.d/" 78 for bin in ${obs-vkcapture32}/bin/* ; do 79 ln -s ${obs-vkcapture32}/bin/obs-gamecapture "$out/bin/$(basename "$bin")32" 80 done 81 ''; 82 83 meta = with lib; { 84 description = "OBS Linux Vulkan/OpenGL game capture"; 85 homepage = "https://github.com/nowrep/obs-vkcapture"; 86 changelog = "https://github.com/nowrep/obs-vkcapture/releases/tag/v${finalAttrs.version}"; 87 maintainers = with maintainers; [ 88 atila 89 pedrohlc 90 ]; 91 license = licenses.gpl2Only; 92 platforms = platforms.linux; 93 }; 94})