input methods: add hime

This commit is contained in:
Antonio Yang 2020-09-17 00:01:57 +08:00
parent 9d71f4f2e2
commit 0c138794af
5 changed files with 102 additions and 1 deletions

View file

@ -29,7 +29,7 @@ in
options.i18n = {
inputMethod = {
enabled = mkOption {
type = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" ]);
type = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" "hime" ]);
default = null;
example = "fcitx";
description = ''
@ -44,6 +44,7 @@ in
<listitem><para>fcitx: A customizable lightweight input method, extra input engines can be added using <literal>i18n.inputMethod.fcitx.engines</literal>.</para></listitem>
<listitem><para>nabi: A Korean input method based on XIM. Nabi doesn't support Qt 5.</para></listitem>
<listitem><para>uim: The universal input method, is a library with a XIM bridge. uim mainly support Chinese, Japanese and Korean.</para></listitem>
<listitem><para>hime: An extremely easy-to-use input method framework.</para></listitem>
</itemizedlist>
'';
};

View file

@ -35,6 +35,11 @@
Uim: The universal input method, is a library with a XIM bridge.
</para>
</listitem>
<listitem>
<para>
Hime: An extremely easy-to-use input method framework.
</para>
</listitem>
</itemizedlist>
<section xml:id="module-services-input-methods-ibus">
<title>IBus</title>
@ -241,4 +246,24 @@ i18n.inputMethod = {
used to choose uim toolbar.
</para>
</section>
<section xml:id="module-services-input-methods-hime">
<title>Hime</title>
<para>
Hime is an extremely easy-to-use input method framework. It is lightweight,
stable, powerful and supports many commonly used input methods, including
Cangjie, Zhuyin, Dayi, Rank, Shrimp, Greek, Japanese Anthy, Korean Pinyin,
Latin Alphabet, Rancang hunting birds, cool music, etc...
</para>
<para>
The following snippet can be used to configure Hime:
</para>
<programlisting>
i18n.inputMethod = {
<link linkend="opt-i18n.inputMethod.enabled">enabled</link> = "hime";
};
</programlisting>
</section>
</chapter>

View file

@ -0,0 +1,28 @@
{ config, pkgs, ... }:
with lib;
{
options = {
i18n.inputMethod.hime = {
enableChewing = mkOption {
type = with types; nullOr bool;
default = null;
description = "enable chewing input method";
};
enableAnthy = mkOption {
type = with types; nullOr bool;
default = null;
description = "enable anthy input method";
};
};
};
config = mkIf (config.i18n.inputMethod.enabled == "hime") {
environment.variables = {
GTK_IM_MODULE = "hime";
QT_IM_MODULE = "hime";
XMODIFIERS = "@im=hime";
};
services.xserver.displayManager.sessionCommands = "${pkgs.hime}/bin/hime &";
};
}

View file

@ -0,0 +1,40 @@
{
stdenv, fetchFromGitHub, pkgconfig, which, gtk2, gtk3, qt4, qt5, libXtst, lib,
enableChewing ? true, libchewing,
enableAnthy ? true, anthy,
}:
stdenv.mkDerivation {
name = "hime";
version = "unstable-2020-06-27";
src = fetchFromGitHub {
owner = "hime-ime";
repo = "hime";
rev = "c89751a58836906e6916355fd037fc74fd7a7a15";
sha256 = "024w67q0clzxigsrvqbxpiy8firjvrqi7wbkkcapzzhzapv3nm8x";
};
nativeBuildInputs = [ which pkgconfig ];
buildInputs = [ libXtst gtk2 gtk3 qt4 qt5.qtbase ]
++ lib.optional enableChewing libchewing
++ lib.optional enableAnthy anthy;
patchPhase = ''
patchShebangs configure
'';
# The configure script already auto-detect libchewing and anthy,
# so we do not need additional flags for libchewing or anthy
configureFlags = [ "--disable-lib64" "--disable-qt5-immodule" ];
meta = with stdenv.lib; {
homepage = "http://hime-ime.github.io/";
downloadPage = "https://github.com/hime-ime/hime/downloads";
description = "A useful input method engine for Asia region";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ yanganto ];
};
}

View file

@ -5596,6 +5596,13 @@ in
nabi = callPackage ../tools/inputmethods/nabi { };
hime = callPackage ../tools/inputmethods/hime {};
hime-all = callPackage ../tools/inputmethods/hime {
enableChewing = true;
enableAnthy = true;
};
nahid-fonts = callPackage ../data/fonts/nahid-fonts { };
namazu = callPackage ../tools/text/namazu { };