From 767cc9fa4dfd1dd0eb52a6d3c6f4d60233cca63e Mon Sep 17 00:00:00 2001 From: Riey Date: Sun, 18 Apr 2021 00:31:42 +0900 Subject: [PATCH] input methods: add kime --- nixos/modules/i18n/input-method/default.nix | 3 +- nixos/modules/i18n/input-method/default.xml | 22 +++++++++ nixos/modules/i18n/input-method/kime.nix | 49 +++++++++++++++++++++ nixos/modules/module-list.nix | 1 + 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/i18n/input-method/kime.nix diff --git a/nixos/modules/i18n/input-method/default.nix b/nixos/modules/i18n/input-method/default.nix index 4649f9b862a..bbc5783565a 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" "fcitx5" "nabi" "uim" "hime" ]); + type = types.nullOr (types.enum [ "ibus" "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]); default = null; example = "fcitx"; description = '' @@ -46,6 +46,7 @@ in 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. + kime: Koream IME. ''; }; diff --git a/nixos/modules/i18n/input-method/default.xml b/nixos/modules/i18n/input-method/default.xml index 73911059f8a..dd66316c730 100644 --- a/nixos/modules/i18n/input-method/default.xml +++ b/nixos/modules/i18n/input-method/default.xml @@ -40,6 +40,11 @@ Hime: An extremely easy-to-use input method framework. + + + Kime: Korean IME + +
IBus @@ -264,6 +269,23 @@ i18n.inputMethod = { i18n.inputMethod = { enabled = "hime"; }; + +
+
+ Kime + + + Kime is Korean IME. it's built with Rust language and let you get simple, safe, fast Korean typing + + + + The following snippet can be used to configure Kime: + + + +i18n.inputMethod = { + enabled = "kime"; +};
diff --git a/nixos/modules/i18n/input-method/kime.nix b/nixos/modules/i18n/input-method/kime.nix new file mode 100644 index 00000000000..2a73cb3f460 --- /dev/null +++ b/nixos/modules/i18n/input-method/kime.nix @@ -0,0 +1,49 @@ +{ config, pkgs, lib, generators, ... }: +with lib; +let + cfg = config.i18n.inputMethod.kime; + yamlFormat = pkgs.formats.yaml { }; +in +{ + options = { + i18n.inputMethod.kime = { + config = mkOption { + type = yamlFormat.type; + default = { }; + example = literalExample '' + { + daemon = { + modules = ["Xim" "Indicator"]; + }; + + indicator = { + icon_color = "White"; + }; + + engine = { + hangul = { + layout = "dubeolsik"; + }; + }; + } + ''; + description = '' + kime configuration. Refer to for details on supported values. + ''; + }; + }; + }; + + config = mkIf (config.i18n.inputMethod.enabled == "kime") { + i18n.inputMethod.package = pkgs.kime; + + environment.variables = { + GTK_IM_MODULE = "kime"; + QT_IM_MODULE = "kime"; + XMODIFIERS = "@im=kime"; + }; + + environment.etc."xdg/kime/config.yaml".text = replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.config); + }; +} + diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index f72be732216..67f852ca3f4 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -92,6 +92,7 @@ ./i18n/input-method/ibus.nix ./i18n/input-method/nabi.nix ./i18n/input-method/uim.nix + ./i18n/input-method/kime.nix ./installer/tools/tools.nix ./misc/assertions.nix ./misc/crashdump.nix