diff --git a/nixos/modules/i18n/inputMethod/default.nix b/nixos/modules/i18n/inputMethod/default.nix new file mode 100644 index 000000000000..7e6a25bfb084 --- /dev/null +++ b/nixos/modules/i18n/inputMethod/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/inputMethod/fcitx.nix b/nixos/modules/i18n/inputMethod/fcitx.nix index b0e7578810ad..f168f4451703 100644 --- a/nixos/modules/i18n/inputMethod/fcitx.nix +++ b/nixos/modules/i18n/inputMethod/fcitx.nix @@ -14,15 +14,6 @@ in options = { i18n.inputMethod.fcitx = { - enable = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Enable Fcitx input method. - Fcitx can be used to input of Chinese, Korean, Japanese and other special characters. - ''; - }; engines = mkOption { type = with types; listOf fcitxEngine; default = []; @@ -36,7 +27,7 @@ in }; - config = mkIf cfg.enable { + config = mkIf (config.i18n.inputMethod.enabled == "fcitx") { environment.systemPackages = [ fcitxPackage ]; gtkPlugins = [ fcitxPackage ]; qtPlugins = [ fcitxPackage ]; diff --git a/nixos/modules/i18n/inputMethod/ibus.nix b/nixos/modules/i18n/inputMethod/ibus.nix index e4bc15cf8912..86059751a3d2 100644 --- a/nixos/modules/i18n/inputMethod/ibus.nix +++ b/nixos/modules/i18n/inputMethod/ibus.nix @@ -13,15 +13,6 @@ in { options = { i18n.inputMethod.ibus = { - enable = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Enable IBus input method. - IBus can be used input of Chinese, Korean, Japanese and other special characters. - ''; - }; engines = mkOption { type = with types; listOf ibusEngine; default = []; @@ -34,7 +25,7 @@ in }; }; - config = mkIf cfg.enable { + config = mkIf (config.i18n.inputMethod.enabled == "ibus") { # Without dconf enabled it is impossible to use IBus environment.systemPackages = [ ibusPackage pkgs.gnome3.dconf ]; diff --git a/nixos/modules/i18n/inputMethod/nabi.nix b/nixos/modules/i18n/inputMethod/nabi.nix index 7f97135fee1e..8c3965955130 100644 --- a/nixos/modules/i18n/inputMethod/nabi.nix +++ b/nixos/modules/i18n/inputMethod/nabi.nix @@ -1,28 +1,8 @@ { config, pkgs, lib, ... }: with lib; - -let - cfg = config.i18n.inputMethod.nabi; -in { - options = { - - i18n.inputMethod.nabi = { - enable = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Enable nabi input method. - Nabi can be used to input Korean. - ''; - }; - }; - - }; -{ - config = mkIf cfg.enable { + config = mkIf (config.i18n.inputMethod.enabled == "nabi") { environment.systemPackages = [ pkgs.nabi ]; qtPlugins = [ pkgs.nabi ]; diff --git a/nixos/modules/i18n/inputMethod/uim.nix b/nixos/modules/i18n/inputMethod/uim.nix index 0154cdc5057a..401e1932f70c 100644 --- a/nixos/modules/i18n/inputMethod/uim.nix +++ b/nixos/modules/i18n/inputMethod/uim.nix @@ -9,15 +9,6 @@ in options = { i18n.inputMethod.uim = { - enable = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Enable uim input method. - Uim can be used to input of Chinese, Korean, Japanese and other special characters. - ''; - }; toolbar = mkOption { type = types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt4" ]; default = "gtk"; @@ -30,7 +21,7 @@ in }; - config = mkIf cfg.enable { + config = mkIf (config.i18n.inputMethod.enabled == "uim") { environment.systemPackages = [ pkgs.uim ]; gtkPlugins = [ pkgs.uim ]; qtPlugins = [ pkgs.uim ]; diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 7fe4a90a1354..eb4045fdfdc3 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -43,6 +43,7 @@ ./hardware/video/nvidia.nix ./hardware/video/ati.nix ./hardware/video/webcam/facetimehd.nix + ./i18n/inputMethod/default.nix ./i18n/inputMethod/fcitx.nix ./i18n/inputMethod/ibus.nix ./i18n/inputMethod/nabi.nix diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 698c28f37c8e..6d5ee6fc84e9 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -60,7 +60,6 @@ with lib; (mkRenamedOptionModule [ "services" "tarsnap" "config" ] [ "services" "tarsnap" "archives" ]) # ibus - (mkRenamedOptionModule [ "programs" "ibus" "enable" ] [ "i18n" "inputMethod" "ibus" "enable" ]) (mkRenamedOptionModule [ "programs" "ibus" "plugins" ] [ "i18n" "inputMethod" "ibus" "engines" ]) # proxy