1 { lib, stdenv, fetchurl, cmake, pkg-config, fcitx, gettext, libpinyin, glib, pcre, dbus, qtwebengine, qtbase, fcitx-qt5 }:
3 stdenv.mkDerivation rec {
4 pname = "fcitx-libpinyin";
8 url = "http://download.fcitx-im.org/fcitx-libpinyin/${pname}-${version}.tar.xz";
9 sha256 = "1wvsc21imbgq3chlxfw4aycmkb2vi1bkjj9frvhga2m5b5pq82k5";
12 nativeBuildInputs = [ cmake pkg-config ];
13 buildInputs = [ fcitx-qt5 qtbase qtwebengine.dev fcitx gettext libpinyin glib pcre dbus ];
15 # With a typical installation via NixOS option i18n.inputMethod.fcitx.engines,
16 # the FCITXDIR environment variable is set to $out of fcitx-with-plugins,
17 # which leads to an incorrect path for pinyin data.
19 # It is impossible or difficult to fix this issue without patching. We want
20 # FCITXDIR to point into libpinyin, which is currently not symlinked within
21 # fcitx-with-plugins (only fcitx-libpinyin is symlinked). Also, FCITXDIR
22 # doesn't accept multiple directories.
23 patches = [ ./datapath.patch ];
26 substituteInPlace src/cmake_install.cmake \
27 --replace ${fcitx} $out
28 substituteInPlace data/cmake_install.cmake \
29 --replace ${fcitx} $out
30 substituteInPlace dictmanager/cmake_install.cmake \
31 --replace ${fcitx} $out
35 ZHUYIN_DATA_FILE_NAME = "model.text.20161206.tar.gz";
36 store_path = fetchurl {
37 url = "https://download.fcitx-im.org/data/${ZHUYIN_DATA_FILE_NAME}";
38 sha256 = "017p11si1b7bkwx36xaybq5a9icq1pd7x1jbymqw92akfgjj8w2w";
42 cp -rv ${store_path} $NIX_BUILD_TOP/$name/data/${ZHUYIN_DATA_FILE_NAME}
45 dontWrapQtApps = true;
49 description = "Fcitx Wrapper for libpinyin, Library to deal with pinyin";
50 homepage = "https://github.com/fcitx/fcitx-libpinyin";
51 license = licenses.gpl3Plus;
52 maintainers = with maintainers; [ ericsagnes ];
53 platforms = platforms.linux;