From c158b6865ff556bb89aa2bf0ba268f9042a15fd6 Mon Sep 17 00:00:00 2001 From: Mauritius Clemens Date: Tue, 9 Sep 2025 18:54:20 +0200 Subject: [PATCH] crow-translate: 3.1.0 -> 4.0.2 Co-authored-by: Nikolay Korotkiy Co-authored-by: Fedi Jamoussi --- pkgs/by-name/cr/crow-translate/package.nix | 56 ++++++++++++---------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/pkgs/by-name/cr/crow-translate/package.nix b/pkgs/by-name/cr/crow-translate/package.nix index be12eb2859f8..073d2722bd44 100644 --- a/pkgs/by-name/cr/crow-translate/package.nix +++ b/pkgs/by-name/cr/crow-translate/package.nix @@ -5,59 +5,63 @@ cmake, extra-cmake-modules, leptonica, - libsForQt5, - qt5, - tesseract4, - gst_all_1, + qt6, + tesseract, testers, + kdePackages, + onnxruntime, + withPiper ? true, }: stdenv.mkDerivation (finalAttrs: { pname = "crow-translate"; - version = "3.1.0"; + version = "4.0.2"; src = fetchFromGitLab { domain = "invent.kde.org"; owner = "office"; repo = "crow-translate"; - rev = "v${finalAttrs.version}"; - hash = "sha256-zL+Ucw6rzIoEaBHi/uqKQB0cnR6aAcF8MPOG3hwK3iA="; + tag = "v${finalAttrs.version}"; + hash = "sha256-hrxYC6zdh4aG9AkHZcnOE5jihJSo3xrq0hzBRE8NtRw="; fetchSubmodules = true; }; postPatch = '' substituteInPlace data/org.kde.CrowTranslate.desktop.in \ - --subst-var-by QT_BIN_DIR ${lib.getBin qt5.qttools}/bin + --subst-var-by QT_BIN_DIR ${lib.getBin qt6.qttools}/bin ''; nativeBuildInputs = [ cmake extra-cmake-modules - qt5.qttools - qt5.wrapQtAppsHook + qt6.qttools + qt6.wrapQtAppsHook ]; buildInputs = [ - libsForQt5.kwayland + kdePackages.kwayland leptonica - tesseract4 - qt5.qtmultimedia - qt5.qtx11extras + tesseract + qt6.qtbase + qt6.qtmultimedia + qt6.qtscxml + qt6.qtspeech ] - ++ (with gst_all_1; [ - gstreamer - gst-plugins-base - gst-plugins-good - gst-plugins-bad - ]); - - preFixup = '' - qtWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0") + ++ lib.optionals withPiper [ + onnxruntime + ]; + cmakeFlags = [ + (lib.cmakeBool "ONNXRuntime_USE_STATIC" false) + (lib.cmakeBool "WITH_PIPER_TTS" withPiper) + ]; + # Necessary for KWin D-BUS authorization for taking screenshots, without + # which the app falls back to interactive capture, which has some limitations. + postInstall = '' + substituteInPlace $out/share/applications/org.kde.CrowTranslate.desktop \ + --replace-fail 'Exec=crow' "Exec=$out/bin/crow" ''; - passthru.tests.version = testers.testVersion { - package = finalAttrs.finalPackage; - }; + passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; }; meta = { description = "Simple and lightweight translator that allows to translate and speak text using Google, Yandex and Bing";