{ lib, stdenv, fetchFromGitHub, cmake, makeWrapper, pkg-config, wrapQtAppsHook, nix-update-script, grim, hyprland, hyprland-protocols, hyprlang, hyprutils, hyprwayland-scanner, libdrm, libgbm, pipewire, qtbase, qttools, qtwayland, sdbus-cpp_2, slurp, wayland, wayland-protocols, wayland-scanner, debug ? false, }: stdenv.mkDerivation (finalAttrs: { pname = "xdg-desktop-portal-hyprland"; version = "1.4.1"; src = fetchFromGitHub { owner = "hyprwm"; repo = "xdg-desktop-portal-hyprland"; tag = "v${finalAttrs.version}"; hash = "sha256-sRAGZVUPgwxpx19uZwaSERa86g1AbsBUQ3SxhaRPgeg="; }; depsBuildBuild = [ pkg-config ]; nativeBuildInputs = [ cmake makeWrapper pkg-config wrapQtAppsHook hyprwayland-scanner ]; buildInputs = [ hyprland-protocols hyprlang hyprutils libdrm libgbm pipewire qtbase qttools qtwayland sdbus-cpp_2 wayland wayland-protocols wayland-scanner ]; cmakeBuildType = if debug then "Debug" else "RelWithDebInfo"; dontStrip = debug; separateDebugInfo = !debug; dontWrapQtApps = true; postInstall = '' wrapProgramShell $out/bin/hyprland-share-picker \ "''${qtWrapperArgs[@]}" \ --prefix PATH ":" ${ lib.makeBinPath [ slurp hyprland ] } wrapProgramShell $out/libexec/xdg-desktop-portal-hyprland \ --prefix PATH ":" ${ lib.makeBinPath [ (placeholder "out") grim ] } ''; passthru = { updateScript = nix-update-script { }; }; meta = { description = "xdg-desktop-portal backend for Hyprland"; homepage = "https://github.com/hyprwm/xdg-desktop-portal-hyprland"; changelog = "https://github.com/hyprwm/xdg-desktop-portal-hyprland/releases/tag/v${finalAttrs.version}"; mainProgram = "hyprland-share-picker"; license = lib.licenses.bsd3; teams = [ lib.teams.hyprland ]; platforms = lib.platforms.linux; }; })