about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-01-11 02:11:46 +0100
committerGitHub <noreply@github.com>2021-01-11 02:11:46 +0100
commit9411c1d387e09ca0706637eac9e997f86b3c2ed6 (patch)
tree4a94414c8fad76984f9b7aad8d82168e97f14546 /pkgs
parent6af32a6878ba1e5a2233e31f665abca9d6f8f40f (diff)
parentecb69e4a1a2fa96594469afde6b2380f319f5a32 (diff)
Merge pull request #105402 from sikmir/crow-translate
crow-translate: init at 2.6.2
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/misc/crow-translate/default.nix74
-rw-r--r--pkgs/applications/misc/crow-translate/dont-fetch-external-libs.patch33
-rw-r--r--pkgs/applications/misc/crow-translate/fix-qttranslations-path.patch13
-rw-r--r--pkgs/top-level/all-packages.nix2
4 files changed, 122 insertions, 0 deletions
diff --git a/pkgs/applications/misc/crow-translate/default.nix b/pkgs/applications/misc/crow-translate/default.nix
new file mode 100644
index 0000000000000..120bc768c3983
--- /dev/null
+++ b/pkgs/applications/misc/crow-translate/default.nix
@@ -0,0 +1,74 @@
+{ stdenv
+, mkDerivation
+, fetchFromGitHub
+, substituteAll
+, cmake
+, extra-cmake-modules
+, qttools
+, leptonica
+, tesseract4
+, qtmultimedia
+, qtx11extras
+, qttranslations
+}:
+let
+  singleapplication = fetchFromGitHub {
+    owner = "itay-grudev";
+    repo = "SingleApplication";
+    rev = "v3.2.0";
+    sha256 = "0w3z97dcqcz3bf7w6fja4smkafmx9kvhzb9px4k2nfmmyxh4yfma";
+  };
+  qtaskbarcontrol = fetchFromGitHub {
+    owner = "Skycoder42";
+    repo = "QTaskbarControl";
+    rev = "2.0.2";
+    sha256 = "0iymcvq3pv07fs9l4kh6hi1igqr7957iqndhsmg9fqkalf8nqyad";
+  };
+  qhotkey = fetchFromGitHub {
+    owner = "Skycoder42";
+    repo = "QHotkey";
+    rev = "1.4.2";
+    sha256 = "0391fkqrxqmzpvms4rk06aq05l308k6sadp6y3czq0gx2kng8mn9";
+  };
+  qonlinetranslator = fetchFromGitHub {
+    owner = "crow-translate";
+    repo = "QOnlineTranslator";
+    rev = "1.4.1";
+    sha256 = "1c6a8mdxms5vh8l7shi2kqdhafbzm50pbz6g1hhgg6qslla0vfn0";
+  };
+in
+mkDerivation rec {
+  pname = "crow-translate";
+  version = "2.6.2";
+
+  src = fetchFromGitHub {
+    owner = "crow-translate";
+    repo = "crow-translate";
+    rev = version;
+    sha256 = "1jgpqynmxmh6mrknpk5fh96lbdg799axp4cyn5rvalg3sdxajmqc";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./dont-fetch-external-libs.patch;
+      inherit singleapplication qtaskbarcontrol qhotkey qonlinetranslator;
+    })
+    (substituteAll {
+      # See https://github.com/NixOS/nixpkgs/issues/86054
+      src = ./fix-qttranslations-path.patch;
+      inherit qttranslations;
+    })
+  ];
+
+  nativeBuildInputs = [ cmake extra-cmake-modules qttools ];
+
+  buildInputs = [ leptonica tesseract4 qtmultimedia qtx11extras ];
+
+  meta = with stdenv.lib; {
+    description = "A simple and lightweight translator that allows to translate and speak text using Google, Yandex and Bing";
+    homepage = "https://crow-translate.github.io/";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ sikmir ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/applications/misc/crow-translate/dont-fetch-external-libs.patch b/pkgs/applications/misc/crow-translate/dont-fetch-external-libs.patch
new file mode 100644
index 0000000000000..b5f8d4606aa07
--- /dev/null
+++ b/pkgs/applications/misc/crow-translate/dont-fetch-external-libs.patch
@@ -0,0 +1,33 @@
+diff --git i/cmake/ExternalLibraries.cmake w/cmake/ExternalLibraries.cmake
+index d8c88ae..47a12c0 100644
+--- i/cmake/ExternalLibraries.cmake
++++ w/cmake/ExternalLibraries.cmake
+@@ -2,24 +2,20 @@ include(FetchContent)
+ 
+ set(QAPPLICATION_CLASS QApplication)
+ FetchContent_Declare(SingleApplication
+-    GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication
+-    GIT_TAG v3.2.0
++    SOURCE_DIR @singleapplication@
+ )
+ 
+ FetchContent_Declare(QTaskbarControl
+-    GIT_REPOSITORY https://github.com/Skycoder42/QTaskbarControl
+-    GIT_TAG 2.0.2
++    SOURCE_DIR @qtaskbarcontrol@
+ )
+ 
+ option(QHOTKEY_INSTALL OFF)
+ FetchContent_Declare(QHotkey
+-    GIT_REPOSITORY https://github.com/Skycoder42/QHotkey
+-    GIT_TAG 1.4.2
++    SOURCE_DIR @qhotkey@
+ )
+ 
+ FetchContent_Declare(QOnlineTranslator
+-    GIT_REPOSITORY https://github.com/crow-translate/QOnlineTranslator
+-    GIT_TAG 1.4.1
++    SOURCE_DIR @qonlinetranslator@
+ )
+ 
+ FetchContent_MakeAvailable(SingleApplication QTaskbarControl QHotkey QOnlineTranslator)
diff --git a/pkgs/applications/misc/crow-translate/fix-qttranslations-path.patch b/pkgs/applications/misc/crow-translate/fix-qttranslations-path.patch
new file mode 100644
index 0000000000000..816b6c51886aa
--- /dev/null
+++ b/pkgs/applications/misc/crow-translate/fix-qttranslations-path.patch
@@ -0,0 +1,13 @@
+diff --git i/src/settings/appsettings.cpp w/src/settings/appsettings.cpp
+index 7be4573..e65994e 100644
+--- i/src/settings/appsettings.cpp
++++ w/src/settings/appsettings.cpp
+@@ -82,7 +82,7 @@ void AppSettings::applyLanguage(QLocale::Language lang)
+         QLocale::setDefault(QLocale(lang));
+ 
+     s_appTranslator.load(QLocale(), QStringLiteral(PROJECT_NAME), QStringLiteral("_"), QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("translations"), QStandardPaths::LocateDirectory));
+-    s_qtTranslator.load(QLocale(), QStringLiteral("qt"), QStringLiteral("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
++    s_qtTranslator.load(QLocale(), QStringLiteral("qt"), QStringLiteral("_"), QLatin1String("@qttranslations@/translations"));
+ }
+ 
+ QLocale::Language AppSettings::defaultLanguage()
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 5814fc234081e..e201a9ff1b6ff 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -208,6 +208,8 @@ in
 
   cpu-x = callPackage ../applications/misc/cpu-x { };
 
+  crow-translate = libsForQt5.callPackage ../applications/misc/crow-translate { };
+
   dhallToNix = callPackage ../build-support/dhall-to-nix.nix {
     inherit dhall-nix;
   };