diff options
author | Eric Sagnes <eric.sagnes@gmail.com> | 2016-04-12 19:46:12 +0900 |
---|---|---|
committer | Eric Sagnes <eric.sagnes@gmail.com> | 2016-04-12 19:50:26 +0900 |
commit | e6ae05dd8ac9e42b1394701b65452e1e9cef6529 (patch) | |
tree | 5ec6ac166f5a68c2523ee6818058a281fc81b3ca /nixos/modules/i18n/input-method | |
parent | de78fe8f2d78a5ef20d0d355c5dbe9d21b4be22c (diff) | |
download | nixpkgs-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar nixpkgs-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.gz nixpkgs-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.bz2 nixpkgs-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.lz nixpkgs-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.xz nixpkgs-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.zst nixpkgs-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.zip |
input-method module: fix folder case
Diffstat (limited to 'nixos/modules/i18n/input-method')
-rw-r--r-- | nixos/modules/i18n/input-method/default.nix | 29 | ||||
-rw-r--r-- | nixos/modules/i18n/input-method/default.xml | 131 | ||||
-rw-r--r-- | nixos/modules/i18n/input-method/fcitx.nix | 44 | ||||
-rw-r--r-- | nixos/modules/i18n/input-method/ibus.nix | 55 | ||||
-rw-r--r-- | nixos/modules/i18n/input-method/nabi.nix | 16 | ||||
-rw-r--r-- | nixos/modules/i18n/input-method/uim.nix | 37 |
6 files changed, 312 insertions, 0 deletions
diff --git a/nixos/modules/i18n/input-method/default.nix b/nixos/modules/i18n/input-method/default.nix new file mode 100644 index 00000000000..7e6a25bfb08 --- /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: + + <itemizedlist> + <listitem><para>ibus: The intelligent input bus, extra input engines can be added using <literal>i18n.inputMethod.ibus.engines</literal>.</para></listitem> + <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> + </itemizedlist> + ''; + }; + }; + }; +} diff --git a/nixos/modules/i18n/input-method/default.xml b/nixos/modules/i18n/input-method/default.xml new file mode 100644 index 00000000000..c55ac1ec245 --- /dev/null +++ b/nixos/modules/i18n/input-method/default.xml @@ -0,0 +1,131 @@ +<chapter xmlns="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xi="http://www.w3.org/2001/XInclude" + version="5.0" + xml:id="module-services-input-methods"> + +<title>Input Methods</title> + +<para>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.</para> + +<para>The following input methods are available in NixOS:</para> + +<itemizedlist> + <listitem><para>IBus: The intelligent input bus.</para></listitem> + <listitem><para>Fcitx: A customizable lightweight input + method.</para></listitem> + <listitem><para>Nabi: A Korean input method based on XIM.</para></listitem> + <listitem><para>Uim: The universal input method, is a library with a XIM + bridge.</para></listitem> +</itemizedlist> + +<section><title>IBus</title> + +<para>IBus is an Intelligent Input Bus. It provides full featured and user + friendly input method user interface.</para> + +<para>The following snippet can be used to configure IBus:</para> + +<programlisting> +i18n.inputMethod = { + enabled = "ibus"; + ibus.engines = with pkgs.ibus-engines; [ anthy hangul mozc ]; +}; +</programlisting> + +<para><literal>i18n.inputMethod.ibus.engines</literal> is optional and can be + used to add extra IBus engines.</para> + +<para>Available extra IBus engines are:</para> + +<itemizedlist> + <listitem><para>Anthy (<literal>ibus-engines.anthy</literal>): Anthy is a + system for Japanese input method. It converts Hiragana text to Kana Kanji + mixed text.</para></listitem> + <listitem><para>Hangul (<literal>ibus-engines.hangul</literal>): Korean input + method.</para></listitem> + <listitem><para>m17n (<literal>ibus-engines.m17n</literal>): m17n is an input + method that uses input methods and corresponding icons in the m17n + database.</para></listitem> + <listitem><para>mozc (<literal>ibus-engines.mozc</literal>): A Japanese input + method from Google.</para></listitem> + <listitem><para>Table (<literal>ibus-engines.table</literal>): An input method + that load tables of input methods.</para></listitem> + <listitem><para>table-others (<literal>ibus-engines.table-others</literal>): + Various table-based input methods.</para></listitem> +</itemizedlist> +</section> + +<section><title>Fcitx</title> + +<para>Fcitx is an input method framework with extension support. It has three + built-in Input Method Engine, Pinyin, QuWei and Table-based input + methods.</para> +<para>The following snippet can be used to configure Fcitx:</para> + +<programlisting> +i18n.inputMethod = { + enabled = "fcitx"; + fcitx.engines = with pkgs.fcitx-engines; [ mozc hangul m17n ]; +}; +</programlisting> + +<para><literal>i18n.inputMethod.fcitx.engines</literal> is optional and can be + used to add extra Fcitx engines.</para> + +<para>Available extra Fcitx engines are:</para> + +<itemizedlist> + <listitem><para>Anthy (<literal>fcitx-engines.anthy</literal>): Anthy is a + system for Japanese input method. It converts Hiragana text to Kana Kanji + mixed text.</para></listitem> + <listitem><para>Chewing (<literal>fcitx-engines.chewing</literal>): Chewing is + an intelligent Zhuyin input method. It is one of the most popular input + methods among Traditional Chinese Unix users.</para></listitem> + <listitem><para>Hangul (<literal>fcitx-engines.hangul</literal>): Korean input + method.</para></listitem> + <listitem><para>m17n (<literal>fcitx-engines.m17n</literal>): m17n is an input + method that uses input methods and corresponding icons in the m17n + database.</para></listitem> + <listitem><para>mozc (<literal>fcitx-engines.mozc</literal>): A Japanese input + method from Google.</para></listitem> + <listitem><para>table-others (<literal>fcitx-engines.table-others</literal>): + Various table-based input methods.</para></listitem> +</itemizedlist> +</section> + +<section><title>Nabi</title> + +<para>Nabi is an easy to use Korean X input method. It allows you to enter + phonetic Korean characters (hangul) and pictographic Korean characters + (hanja).</para> +<para>The following snippet can be used to configure Nabi:</para> + +<programlisting> +i18n.inputMethod = { + enabled = "nabi"; +}; +</programlisting> +</section> + +<section><title>Uim</title> + +<para>Uim (short for "universal input method") is a multilingual input method + framework. Applications can use it through so-called bridges.</para> +<para>The following snippet can be used to configure uim:</para> + +<programlisting> +i18n.inputMethod = { + enabled = "uim"; +}; +</programlisting> + +<para>Note: The <literal>i18n.inputMethod.uim.toolbar</literal> option can be + used to choose uim toolbar.</para> + +</section> +</chapter> diff --git a/nixos/modules/i18n/input-method/fcitx.nix b/nixos/modules/i18n/input-method/fcitx.nix new file mode 100644 index 00000000000..8e31743504f --- /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: "<literal>${name}</literal>") + (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 00000000000..bb80f43634d --- /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: "<literal>${name}</literal>") + (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 00000000000..c6708365eff --- /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 00000000000..f8a3e560656 --- /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} & + ''; + }; +} |