{ stdenv, lib, fetchgit, makeWrapper, meson, ninja, addDriverRunpath, pkg-config, libxcomposite, libpulseaudio, dbus, ffmpeg, wayland, wayland-scanner, vulkan-headers, pipewire, libdrm, libva, libglvnd, libxdamage, libxi, libxrandr, libxfixes, libjpeg_turbo, wrapperDir ? "/run/wrappers/bin", gitUpdater, }: stdenv.mkDerivation rec { pname = "gpu-screen-recorder"; version = "5.12.4"; src = fetchgit { url = "https://repo.dec05eba.com/${pname}"; tag = version; hash = "sha256-VceAqiWeDJEAqx96Y4WHUTsPLeb4HvkNbl4fmMi296g="; }; nativeBuildInputs = [ pkg-config makeWrapper meson ninja ]; buildInputs = [ libxcomposite libpulseaudio dbus ffmpeg pipewire wayland wayland-scanner vulkan-headers libdrm libva libxdamage libxi libxrandr libxfixes ]; mesonFlags = [ # Install the upstream systemd unit (lib.mesonBool "systemd" true) # Enable Wayland support (lib.mesonBool "portal" true) # Handle by the module (lib.mesonBool "capabilities" true) (lib.mesonBool "nvidia_suspend_fix" true) ]; postPatch = '' substituteInPlace src/capture/v4l2.c \ --replace-fail "libturbojpeg.so.0" "${lib.getLib libjpeg_turbo}/lib/libturbojpeg.so.0" ''; postInstall = '' mkdir $out/bin/.wrapped mv $out/bin/gpu-screen-recorder $out/bin/.wrapped/ makeWrapper "$out/bin/.wrapped/gpu-screen-recorder" "$out/bin/gpu-screen-recorder" \ --prefix LD_LIBRARY_PATH : "${ lib.makeLibraryPath [ libglvnd addDriverRunpath.driverLink ] }" \ --prefix PATH : "${wrapperDir}" \ --suffix PATH : "$out/bin" ''; passthru.updateScript = gitUpdater {}; meta = { description = "Screen recorder that has minimal impact on system performance by recording a window using the GPU only"; homepage = "https://git.dec05eba.com/gpu-screen-recorder/about/"; license = lib.licenses.gpl3Only; mainProgram = "gpu-screen-recorder"; maintainers = with lib.maintainers; [ babbaj js6pak ]; platforms = ["x86_64-linux"]; }; }