about summary refs log tree commit diff
path: root/pkgs/applications/misc/crow-translate/default.nix
blob: 09a7595765d9c947296c1040063972e607100c20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ lib
, stdenv
, nix-update-script
, fetchFromGitHub
, substituteAll
, cmake
, extra-cmake-modules
, qttools
, leptonica
, tesseract4
, qtmultimedia
, qtx11extras
, qttranslations
, wrapQtAppsHook
}:

stdenv.mkDerivation rec {
  pname = "crow-translate";
  version = "2.9.5";

  src = fetchFromGitHub {
    owner = "crow-translate";
    repo = pname;
    rev = version;
    sha256 = "sha256-AzwJJ85vxXsc0+W3QM8citN5f0AD6APQVd9628cfLgI=";
    fetchSubmodules = true;
  };

  patches = [
    (substituteAll {
      # See https://github.com/NixOS/nixpkgs/issues/86054
      src = ./fix-qttranslations-path.patch;
      inherit qttranslations;
    })
  ];

  nativeBuildInputs = [ cmake extra-cmake-modules qttools wrapQtAppsHook ];

  buildInputs = [ leptonica tesseract4 qtmultimedia qtx11extras ];

  postInstall = ''
    substituteInPlace $out/share/applications/io.crow_translate.CrowTranslate.desktop \
      --replace "Exec=qdbus" "Exec=${lib.getBin qttools}/bin/qdbus"
  '';

  passthru = {
    updateScript = nix-update-script {
      attrPath = pname;
    };
  };

  meta = with 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;
  };
}