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