1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchFromGitHub,
6 pkg-config,
7 buildPackages,
8 cmake,
9 extra-cmake-modules,
10 wayland-scanner,
11 cairo,
12 pango,
13 expat,
14 fribidi,
15 wayland,
16 systemd,
17 wayland-protocols,
18 json_c,
19 isocodes,
20 xkeyboard_config,
21 enchant,
22 gdk-pixbuf,
23 libGL,
24 libuuid,
25 libselinux,
26 libXdmcp,
27 libsepol,
28 libxkbcommon,
29 libthai,
30 libdatrie,
31 xcbutilkeysyms,
32 xcbutil,
33 xcbutilwm,
34 xcb-imdkit,
35 libxkbfile,
36 nixosTests,
37 gettext,
38}:
39let
40 enDictVer = "20121020";
41 enDict = fetchurl {
42 url = "https://download.fcitx-im.org/data/en_dict-${enDictVer}.tar.gz";
43 hash = "sha256-xEpdeEeSXuqeTS0EdI1ELNKN2SmaC1cu99kerE9abOs=";
44 };
45in
46stdenv.mkDerivation rec {
47 pname = "fcitx5";
48 version = "5.1.14";
49
50 src = fetchFromGitHub {
51 owner = "fcitx";
52 repo = pname;
53 rev = version;
54 hash = "sha256-wLJZyoWjf02+m8Kw+IcfbZY2NnjMGtCWur2+w141eS4=";
55 };
56
57 prePatch = ''
58 ln -s ${enDict} src/modules/spell/$(stripHash ${enDict})
59 '';
60
61 nativeBuildInputs = [
62 cmake
63 extra-cmake-modules
64 pkg-config
65 wayland-scanner
66 gettext
67 ];
68
69 buildInputs = [
70 expat
71 isocodes
72 cairo
73 enchant
74 pango
75 libthai
76 libdatrie
77 fribidi
78 systemd
79 gdk-pixbuf
80 wayland
81 wayland-protocols
82 json_c
83 libGL
84 libuuid
85 libselinux
86 libsepol
87 libXdmcp
88 libxkbcommon
89 xcbutil
90 xcbutilwm
91 xcbutilkeysyms
92 xcb-imdkit
93 xkeyboard_config
94 libxkbfile
95 ];
96
97 cmakeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
98 (lib.cmakeFeature "CMAKE_CROSSCOMPILING_EMULATOR" (stdenv.hostPlatform.emulator buildPackages))
99 ];
100
101 strictDeps = true;
102
103 passthru = {
104 updateScript = ./update.py;
105 tests = {
106 inherit (nixosTests) fcitx5;
107 };
108 };
109
110 meta = with lib; {
111 description = "Next generation of fcitx";
112 homepage = "https://github.com/fcitx/fcitx5";
113 license = licenses.lgpl21Plus;
114 mainProgram = "fcitx5";
115 maintainers = with maintainers; [ poscat ];
116 platforms = platforms.linux;
117 };
118}