From e6ae05dd8ac9e42b1394701b65452e1e9cef6529 Mon Sep 17 00:00:00 2001 From: Eric Sagnes Date: Tue, 12 Apr 2016 19:46:12 +0900 Subject: input-method module: fix folder case --- nixos/modules/i18n/input-method/default.nix | 29 ++++++ nixos/modules/i18n/input-method/default.xml | 131 ++++++++++++++++++++++++++++ nixos/modules/i18n/input-method/fcitx.nix | 44 ++++++++++ nixos/modules/i18n/input-method/ibus.nix | 55 ++++++++++++ nixos/modules/i18n/input-method/nabi.nix | 16 ++++ nixos/modules/i18n/input-method/uim.nix | 37 ++++++++ 6 files changed, 312 insertions(+) create mode 100644 nixos/modules/i18n/input-method/default.nix create mode 100644 nixos/modules/i18n/input-method/default.xml create mode 100644 nixos/modules/i18n/input-method/fcitx.nix create mode 100644 nixos/modules/i18n/input-method/ibus.nix create mode 100644 nixos/modules/i18n/input-method/nabi.nix create mode 100644 nixos/modules/i18n/input-method/uim.nix (limited to 'nixos/modules/i18n/input-method') diff --git a/nixos/modules/i18n/input-method/default.nix b/nixos/modules/i18n/input-method/default.nix new file mode 100644 index 000000000000..7e6a25bfb084 --- /dev/null +++ b/nixos/modules/i18n/input-method/default.nix @@ -0,0 +1,29 @@ +{ config, pkgs, lib, ... }: + +with lib; + +{ + options = { + i18n.inputMethod = { + enabled = mkOption { + type = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" ]); + default = null; + example = "fcitx"; + description = '' + Select the enabled input method. Input methods is a software to input symbols that are not available on standard input devices. + + Input methods are specially used to input Chinese, Japanese and Korean characters. + + Currently the following input methods are available in NixOS: + + + ibus: The intelligent input bus, extra input engines can be added using i18n.inputMethod.ibus.engines. + 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. + + ''; + }; + }; + }; +} diff --git a/nixos/modules/i18n/input-method/default.xml b/nixos/modules/i18n/input-method/default.xml new file mode 100644 index 000000000000..c55ac1ec2456 --- /dev/null +++ b/nixos/modules/i18n/input-method/default.xml @@ -0,0 +1,131 @@ + + +Input Methods + +Input methods are an operating system component that allows any data, such + as keyboard strokes or mouse movements, to be received as input. In this way + users can enter characters and symbols not found on their input devices. Using + an input method is obligatory for any language that has more graphemes than + there are keys on the keyboard. + +The following input methods are available in NixOS: + + + IBus: The intelligent input bus. + Fcitx: A customizable lightweight input + method. + Nabi: A Korean input method based on XIM. + Uim: The universal input method, is a library with a XIM + bridge. + + +
IBus + +IBus is an Intelligent Input Bus. It provides full featured and user + friendly input method user interface. + +The following snippet can be used to configure IBus: + + +i18n.inputMethod = { + enabled = "ibus"; + ibus.engines = with pkgs.ibus-engines; [ anthy hangul mozc ]; +}; + + +i18n.inputMethod.ibus.engines is optional and can be + used to add extra IBus engines. + +Available extra IBus engines are: + + + Anthy (ibus-engines.anthy): Anthy is a + system for Japanese input method. It converts Hiragana text to Kana Kanji + mixed text. + Hangul (ibus-engines.hangul): Korean input + method. + m17n (ibus-engines.m17n): m17n is an input + method that uses input methods and corresponding icons in the m17n + database. + mozc (ibus-engines.mozc): A Japanese input + method from Google. + Table (ibus-engines.table): An input method + that load tables of input methods. + table-others (ibus-engines.table-others): + Various table-based input methods. + +
+ +
Fcitx + +Fcitx is an input method framework with extension support. It has three + built-in Input Method Engine, Pinyin, QuWei and Table-based input + methods. +The following snippet can be used to configure Fcitx: + + +i18n.inputMethod = { + enabled = "fcitx"; + fcitx.engines = with pkgs.fcitx-engines; [ mozc hangul m17n ]; +}; + + +i18n.inputMethod.fcitx.engines is optional and can be + used to add extra Fcitx engines. + +Available extra Fcitx engines are: + + + Anthy (fcitx-engines.anthy): Anthy is a + system for Japanese input method. It converts Hiragana text to Kana Kanji + mixed text. + Chewing (fcitx-engines.chewing): Chewing is + an intelligent Zhuyin input method. It is one of the most popular input + methods among Traditional Chinese Unix users. + Hangul (fcitx-engines.hangul): Korean input + method. + m17n (fcitx-engines.m17n): m17n is an input + method that uses input methods and corresponding icons in the m17n + database. + mozc (fcitx-engines.mozc): A Japanese input + method from Google. + table-others (fcitx-engines.table-others): + Various table-based input methods. + +
+ +
Nabi + +Nabi is an easy to use Korean X input method. It allows you to enter + phonetic Korean characters (hangul) and pictographic Korean characters + (hanja). +The following snippet can be used to configure Nabi: + + +i18n.inputMethod = { + enabled = "nabi"; +}; + +
+ +
Uim + +Uim (short for "universal input method") is a multilingual input method + framework. Applications can use it through so-called bridges. +The following snippet can be used to configure uim: + + +i18n.inputMethod = { + enabled = "uim"; +}; + + +Note: The i18n.inputMethod.uim.toolbar option can be + used to choose uim toolbar. + +
+
diff --git a/nixos/modules/i18n/input-method/fcitx.nix b/nixos/modules/i18n/input-method/fcitx.nix new file mode 100644 index 000000000000..8e31743504f1 --- /dev/null +++ b/nixos/modules/i18n/input-method/fcitx.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.i18n.inputMethod.fcitx; + fcitxPackage = pkgs.fcitx-with-plugins.override { plugins = cfg.engines; }; + fcitxEngine = types.package // { + name = "fcitx-engine"; + check = x: (lib.types.package.check x) && (attrByPath ["meta" "isFcitxEngine"] false x); + }; +in +{ + options = { + + i18n.inputMethod.fcitx = { + engines = mkOption { + type = with types; listOf fcitxEngine; + default = []; + example = literalExample "with pkgs.fcitx-engines; [ mozc hangul ]"; + description = + let + engines = + lib.concatStringsSep ", " + (map (name: "${name}") + (lib.attrNames pkgs.fcitx-engines)); + in + "Enabled Fcitx engines. Available engines are: ${engines}."; + }; + }; + + }; + + config = mkIf (config.i18n.inputMethod.enabled == "fcitx") { + environment.systemPackages = [ fcitxPackage ]; + + environment.variables = { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + }; + services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx"; + }; +} diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix new file mode 100644 index 000000000000..bb80f43634d3 --- /dev/null +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -0,0 +1,55 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.i18n.inputMethod.ibus; + ibusPackage = pkgs.ibus-with-plugins.override { plugins = cfg.engines; }; + ibusEngine = types.package // { + name = "ibus-engine"; + check = x: (lib.types.package.check x) && (attrByPath ["meta" "isIbusEngine"] false x); + }; + + ibusAutostart = pkgs.writeTextFile { + name = "autostart-ibus-daemon"; + destination = "/etc/xdg/autostart/ibus-daemon.desktop"; + text = '' + [Desktop Entry] + Name=IBus + Type=Application + Exec=${ibusPackage}/bin/ibus-daemon --daemonize --xim --cache=refresh + ''; + }; +in +{ + options = { + i18n.inputMethod.ibus = { + engines = mkOption { + type = with types; listOf ibusEngine; + default = []; + example = literalExample "with pkgs.ibus-engines; [ mozc hangul ]"; + description = + let + engines = + lib.concatStringsSep ", " + (map (name: "${name}") + (lib.attrNames pkgs.ibus-engines)); + in + "Enabled IBus engines. Available engines are: ${engines}."; + }; + }; + }; + + config = mkIf (config.i18n.inputMethod.enabled == "ibus") { + # Without dconf enabled it is impossible to use IBus + environment.systemPackages = with pkgs; [ + ibusPackage ibus-qt gnome3.dconf ibusAutostart + ]; + + environment.variables = { + GTK_IM_MODULE = "ibus"; + QT_IM_MODULE = "ibus"; + XMODIFIERS = "@im=ibus"; + }; + }; +} diff --git a/nixos/modules/i18n/input-method/nabi.nix b/nixos/modules/i18n/input-method/nabi.nix new file mode 100644 index 000000000000..c6708365effa --- /dev/null +++ b/nixos/modules/i18n/input-method/nabi.nix @@ -0,0 +1,16 @@ +{ config, pkgs, lib, ... }: + +with lib; +{ + config = mkIf (config.i18n.inputMethod.enabled == "nabi") { + environment.systemPackages = [ pkgs.nabi ]; + + environment.variables = { + GTK_IM_MODULE = "nabi"; + QT_IM_MODULE = "nabi"; + XMODIFIERS = "@im=nabi"; + }; + + services.xserver.displayManager.sessionCommands = "${pkgs.nabi}/bin/nabi &"; + }; +} diff --git a/nixos/modules/i18n/input-method/uim.nix b/nixos/modules/i18n/input-method/uim.nix new file mode 100644 index 000000000000..f8a3e560656d --- /dev/null +++ b/nixos/modules/i18n/input-method/uim.nix @@ -0,0 +1,37 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.i18n.inputMethod.uim; +in +{ + options = { + + i18n.inputMethod.uim = { + toolbar = mkOption { + type = types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt4" ]; + default = "gtk"; + example = "gtk-systray"; + description = '' + selected UIM toolbar. + ''; + }; + }; + + }; + + config = mkIf (config.i18n.inputMethod.enabled == "uim") { + environment.systemPackages = [ pkgs.uim ]; + + environment.variables = { + GTK_IM_MODULE = "uim"; + QT_IM_MODULE = "uim"; + XMODIFIERS = "@im=uim"; + }; + services.xserver.displayManager.sessionCommands = '' + ${pkgs.uim}/bin/uim-xim & + ${pkgs.uim}/bin/uim-toolbar-${cfg.toolbar} & + ''; + }; +} -- cgit 1.4.1