From 9d71f4f2e20eb6b0f51e99212e66d42c0b89cf2d Mon Sep 17 00:00:00 2001 From: Antonio Yang Date: Thu, 17 Sep 2020 23:25:47 +0800 Subject: [PATCH 1/2] maintainers: add yanganto --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 0f6a2be4bfbc..009d938554c5 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -9728,4 +9728,10 @@ github = "wenngle"; githubId = 63376671; }; + yanganto = { + name = "Antonio Yang"; + email = "yanganto@gmail.com"; + github = "yanganto"; + githubId = 10803111; + }; } From 0c138794af79ddc3907b6e3375edde5aaec08001 Mon Sep 17 00:00:00 2001 From: Antonio Yang Date: Thu, 17 Sep 2020 00:01:57 +0800 Subject: [PATCH 2/2] input methods: add hime --- nixos/modules/i18n/input-method/default.nix | 3 +- nixos/modules/i18n/input-method/default.xml | 25 +++++++++++++ nixos/modules/i18n/input-method/hime.nix | 28 +++++++++++++++ pkgs/tools/inputmethods/hime/default.nix | 40 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 7 ++++ 5 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/i18n/input-method/hime.nix create mode 100644 pkgs/tools/inputmethods/hime/default.nix diff --git a/nixos/modules/i18n/input-method/default.nix b/nixos/modules/i18n/input-method/default.nix index 9548a249efa0..0d6dd3399bfc 100644 --- a/nixos/modules/i18n/input-method/default.nix +++ b/nixos/modules/i18n/input-method/default.nix @@ -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 fcitx: A customizable lightweight input method, extra input engines can be added using i18n.inputMethod.fcitx.engines. nabi: A Korean input method based on XIM. Nabi doesn't support Qt 5. uim: The universal input method, is a library with a XIM bridge. uim mainly support Chinese, Japanese and Korean. + hime: An extremely easy-to-use input method framework. ''; }; diff --git a/nixos/modules/i18n/input-method/default.xml b/nixos/modules/i18n/input-method/default.xml index 117482fb0d57..e15f66690819 100644 --- a/nixos/modules/i18n/input-method/default.xml +++ b/nixos/modules/i18n/input-method/default.xml @@ -35,6 +35,11 @@ Uim: The universal input method, is a library with a XIM bridge. + + + Hime: An extremely easy-to-use input method framework. + +
IBus @@ -241,4 +246,24 @@ i18n.inputMethod = { used to choose uim toolbar.
+
+ Hime + + + 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... + + + + The following snippet can be used to configure Hime: + + + +i18n.inputMethod = { + enabled = "hime"; +}; + +
diff --git a/nixos/modules/i18n/input-method/hime.nix b/nixos/modules/i18n/input-method/hime.nix new file mode 100644 index 000000000000..a1b346a0f840 --- /dev/null +++ b/nixos/modules/i18n/input-method/hime.nix @@ -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 &"; + }; +} diff --git a/pkgs/tools/inputmethods/hime/default.nix b/pkgs/tools/inputmethods/hime/default.nix new file mode 100644 index 000000000000..cce1ec495150 --- /dev/null +++ b/pkgs/tools/inputmethods/hime/default.nix @@ -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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 588c79b785d7..1bc619dce8eb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };