Skip to content
Merged

Add fcitx5 #104658

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/modules/i18n/input-method/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ in
options.i18n = {
inputMethod = {
enabled = mkOption {
type = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" "hime" ]);
type = types.nullOr (types.enum [ "ibus" "fcitx" "fcitx5" "nabi" "uim" "hime" ]);
default = null;
example = "fcitx";
description = ''
Expand Down
33 changes: 33 additions & 0 deletions nixos/modules/i18n/input-method/fcitx5.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ config, pkgs, lib, ... }:

with lib;

let
im = config.i18n.inputMethod;
cfg = im.fcitx5;
fcitx5Package = pkgs.fcitx5-with-addons.override { inherit (cfg) addons; };
in
{
options = {
i18n.inputMethod.fcitx5 = {
addons = mkOption {
type = with types; listOf package;
default = [];
example = with pkgs; [ fcitx5-rime ];
description = ''
Enabled Fcitx5 addons.
'';
};
};
};

config = mkIf (im.enabled == "fcitx5") {
i18n.inputMethod.package = fcitx5Package;

environment.variables = {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
};
}
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
./hardware/xpadneo.nix
./i18n/input-method/default.nix
./i18n/input-method/fcitx.nix
./i18n/input-method/fcitx5.nix
./i18n/input-method/hime.nix
./i18n/input-method/ibus.nix
./i18n/input-method/nabi.nix
Expand Down
63 changes: 63 additions & 0 deletions pkgs/development/libraries/libime/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{ stdenv
, fetchurl
, fetchFromGitHub
, cmake
, extra-cmake-modules
, boost
, python3
, fcitx5
}:

let
table = fetchurl {
url = "https://download.fcitx-im.org/data/table.tar.gz";
sha256 = "1dw7mgbaidv3vqy0sh8dbfv8631d2zwv5mlb7npf69a1f8y0b5k1";
};
arpaVer = "20140820";
arpa = fetchurl {
url = "https://download.fcitx-im.org/data/lm_sc.3gm.arpa-${arpaVer}.tar.bz2";
sha256 = "0bqy3l7mif0yygjrcm65qallszgn17mvgyxhvz7a54zaamyan6vm";
};
dictVer = "20200715";
dict = fetchurl {
url = "https://download.fcitx-im.org/data/dict.utf8-${dictVer}.tar.xz";
sha256 = "1ln7r64j8mc7wz4j0q4v8wd68wy7qqz4bz1dpxk7zqbdvza6rhr3";
};
in
stdenv.mkDerivation rec {
pname = "libime";
version = "1.0.2";

src = fetchFromGitHub {
owner = "fcitx";
repo = "libime";
rev = version;
sha256 = "hDfxuDIj9qx5d+UFwxDdP2PCboPnUV1n+VVoEIGsucM=";
fetchSubmodules = true;
};

prePatch = ''
ln -s ${table} data/$(stripHash ${table})
ln -s ${arpa} data/$(stripHash ${arpa})
ln -s ${dict} data/$(stripHash ${dict})
'';

nativeBuildInputs = [
cmake
extra-cmake-modules
python3
];

buildInputs = [
boost
fcitx5
];

meta = with stdenv.lib; {
description = "A library to support generic input method implementation";
homepage = "https://github.com/fcitx/libime";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ poscat ];
platforms = platforms.linux;
};
}
41 changes: 41 additions & 0 deletions pkgs/development/libraries/xcb-imdkit/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{ stdenv
, fetchFromGitHub
, cmake
, extra-cmake-modules
, uthash
, xcbutil
, xcbutilkeysyms
, xorgproto
}:

stdenv.mkDerivation rec {
pname = "xcb-imdkit";
version = "1.0.1";

src = fetchFromGitHub {
owner = "fcitx";
repo = "xcb-imdkit";
rev = version;
sha256 = "dvax+Wj8+tHdiL6txcuugrOlRnxdIW25DYO4iNAYK8M=";
};

nativeBuildInputs = [
cmake
extra-cmake-modules
xorgproto
uthash
];

buildInputs = [
xcbutil
xcbutilkeysyms
];

meta = with stdenv.lib; {
description = "input method development support for xcb";
homepage = "https://github.com/fcitx/xcb-imdkit";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ poscat ];
platforms = platforms.linux;
};
}
100 changes: 100 additions & 0 deletions pkgs/tools/inputmethods/fcitx5/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{ stdenv
, fetchurl
, fetchFromGitHub
, pkg-config
, cmake
, extra-cmake-modules
, cairo
, cldr-emoji-annotation
, pango
, fribidi
, fmt
, wayland
, systemd
, wayland-protocols
, json_c
, isocodes
, xkeyboard_config
, enchant
, gdk-pixbuf
, libGL
, libevent
, libuuid
, libselinux
, libXdmcp
, libsepol
, libxkbcommon
, libthai
, libdatrie
, xcbutilkeysyms
, pcre
, xcbutilwm
, xcb-imdkit
, libxkbfile
}:
let
enDictVer = "20121020";
enDict = fetchurl {
url = "https://download.fcitx-im.org/data/en_dict-${enDictVer}.tar.gz";
sha256 = "1svcb97sq7nrywp5f2ws57cqvlic8j6p811d9ngflplj8xw5sjn4";
};
in
stdenv.mkDerivation rec {
pname = "fcitx5";
version = "5.0.3";

src = fetchFromGitHub {
owner = "fcitx";
repo = "fcitx5";
rev = version;
sha256 = "QYMH0WbhHqDKUvpj1VOB8U5sbBD89H6moLFkQBJijZA=";
};

prePatch = ''
ln -s ${enDict} src/modules/spell/dict/$(stripHash ${enDict})
'';

nativeBuildInputs = [
cmake
extra-cmake-modules
pkg-config
];

buildInputs = [
fmt
isocodes
cairo
enchant
pango
libthai
libdatrie
fribidi
systemd
gdk-pixbuf
wayland
wayland-protocols
cldr-emoji-annotation
json_c
libGL
libevent
libuuid
libselinux
libsepol
libXdmcp
libxkbcommon
pcre
xcbutilwm
xcbutilkeysyms
xcb-imdkit
xkeyboard_config
libxkbfile
];

meta = with stdenv.lib; {
description = "Next generation of fcitx";
homepage = "https://github.com/fcitx/fcitx5";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ poscat ];
platforms = platforms.linux;
};
}
76 changes: 76 additions & 0 deletions pkgs/tools/inputmethods/fcitx5/fcitx5-chinese-addons.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{ stdenv
, mkDerivation
, fetchurl
, fetchFromGitHub
, cmake
, extra-cmake-modules
, boost
, libime
, fcitx5
, fcitx5-qt
, fcitx5-lua
, qtwebengine
, opencc
, curl
, fmt
, luaSupport ? true
}:

let
pyStrokeVer = "20121124";
pyStroke = fetchurl {
url = "http://download.fcitx-im.org/data/py_stroke-${pyStrokeVer}.tar.gz";
sha256 = "0j72ckmza5d671n2zg0psg7z9iils4gyxz7jgkk54fd4pyljiccf";
};
pyTableVer = "20121124";
pyTable = fetchurl {
url = "http://download.fcitx-im.org/data/py_table-${pyTableVer}.tar.gz";
sha256 = "011cg7wssssm6hm564cwkrrnck2zj5rxi7p9z5akvhg6gp4nl522";
};
in

mkDerivation rec {
pname = "fcitx5-chinese-addons";
version = "5.0.2";

src = fetchFromGitHub {
owner = "fcitx";
repo = "fcitx5-chinese-addons";
rev = version;
sha256 = "11UIMrwzZqO8nrQx5oubeoQN8hspL1mvHw5Dc9sVOqQ=";
};

cmakeFlags = [
"-DUSE_WEBKIT=off"
];

nativeBuildInputs = [
cmake
extra-cmake-modules
boost
fcitx5-lua
];

prePatch = ''
ln -s ${pyStroke} modules/pinyinhelper/$(stripHash ${pyStroke})
ln -s ${pyTable} modules/pinyinhelper/$(stripHash ${pyTable})
'';

buildInputs = [
fcitx5
fcitx5-qt
libime
curl
opencc
qtwebengine
fmt
] ++ stdenv.lib.optional luaSupport fcitx5-lua;

meta = with stdenv.lib; {
description = "Addons related to Chinese, including IME previous bundled inside fcitx4";
homepage = "https://github.com/fcitx/fcitx5-chinese-addons";
license = with licenses; [ gpl2Plus lgpl21Plus ];
maintainers = with maintainers; [ poscat ];
platforms = platforms.linux;
};
}
60 changes: 60 additions & 0 deletions pkgs/tools/inputmethods/fcitx5/fcitx5-configtool.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{ stdenv
, mkDerivation
, fetchFromGitHub
, cmake
, extra-cmake-modules
, fcitx5
, fcitx5-qt
, qtx11extras
, kwidgetsaddons
, kdeclarative
, kirigami2
, isocodes
, xkeyboardconfig
, libxkbfile
, libXdmcp
, kcmSupport ? true
}:

mkDerivation rec {
pname = "fcitx5-configtool";
version = "5.0.1";

src = fetchFromGitHub {
owner = "fcitx";
repo = "fcitx5-configtool";
rev = version;
sha256 = "npSqd0R6bqKc+JxYCGcfVzgNLpuLtnHq6zM58smZ8/I=";
};

cmakeFlags = [
"-DKDE_INSTALL_USE_QT_SYS_PATHS=ON"
];

nativeBuildInputs = [
cmake
extra-cmake-modules
];

buildInputs = [
fcitx5
fcitx5-qt
qtx11extras
kirigami2
isocodes
xkeyboardconfig
libxkbfile
libXdmcp
] ++ stdenv.lib.optionals kcmSupport [
kdeclarative
kwidgetsaddons
];

meta = with stdenv.lib; {
description = "Configuration Tool for Fcitx5";
homepage = "https://github.com/fcitx/fcitx5-configtool";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ poscat ];
platforms = platforms.linux;
};
}
Loading