1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchFromGitHub,
6 cmake,
7 extra-cmake-modules,
8 boost,
9 gettext,
10 libime,
11 fcitx5,
12 fcitx5-qt,
13 fcitx5-lua,
14 qtwebengine,
15 opencc,
16 curl,
17 fmt,
18 qtbase,
19 luaSupport ? true,
20}:
21
22let
23 pyStrokeVer = "20121124";
24 pyStroke = fetchurl {
25 url = "http://download.fcitx-im.org/data/py_stroke-${pyStrokeVer}.tar.gz";
26 hash = "sha256-jrEoqb+kOVLmfPL87h/RNMb0z9MXvC9sOKYV9etk4kg=";
27 };
28 pyTableVer = "20121124";
29 pyTable = fetchurl {
30 url = "http://download.fcitx-im.org/data/py_table-${pyTableVer}.tar.gz";
31 hash = "sha256-QhRqyX3mwT1V+eme2HORX0xmc56cEVMqNFVrrfl5LAQ=";
32 };
33in
34
35stdenv.mkDerivation rec {
36 pname = "fcitx5-chinese-addons";
37 version = "5.1.8";
38
39 src = fetchFromGitHub {
40 owner = "fcitx";
41 repo = pname;
42 rev = version;
43 hash = "sha256-QO136EbUFxT7yA1Fs4DvV0CKpdCMw/s5s9sW3vRzGD8=";
44 };
45
46 nativeBuildInputs = [
47 cmake
48 extra-cmake-modules
49 gettext
50 fcitx5-lua
51 ];
52
53 prePatch = ''
54 ln -s ${pyStroke} modules/pinyinhelper/$(stripHash ${pyStroke})
55 ln -s ${pyTable} modules/pinyinhelper/$(stripHash ${pyTable})
56 '';
57
58 buildInputs = [
59 boost
60 fcitx5
61 fcitx5-qt
62 libime
63 curl
64 opencc
65 qtwebengine
66 fmt
67 ]
68 ++ lib.optional luaSupport fcitx5-lua;
69
70 cmakeFlags = [
71 (lib.cmakeBool "USE_QT6" (lib.versions.major qtbase.version == "6"))
72 ];
73
74 dontWrapQtApps = true;
75
76 meta = with lib; {
77 description = "Addons related to Chinese, including IME previous bundled inside fcitx4";
78 mainProgram = "scel2org5";
79 homepage = "https://github.com/fcitx/fcitx5-chinese-addons";
80 license = with licenses; [
81 gpl2Plus
82 lgpl21Plus
83 ];
84 maintainers = with maintainers; [ poscat ];
85 platforms = platforms.linux;
86 };
87}