1 { config, pkgs, lib, ... }:
3 cfg = config.i18n.inputMethod;
5 allowedTypes = lib.types.enum [ "ibus" "fcitx5" "nabi" "uim" "hime" "kime" ];
7 gtk2_cache = pkgs.runCommand "gtk2-immodule.cache"
8 { preferLocalBuild = true;
9 allowSubstitutes = false;
10 buildInputs = [ pkgs.gtk2 cfg.package ];
13 mkdir -p $out/etc/gtk-2.0/
14 GTK_PATH=${cfg.package}/lib/gtk-2.0/ gtk-query-immodules-2.0 > $out/etc/gtk-2.0/immodules.cache
17 gtk3_cache = pkgs.runCommand "gtk3-immodule.cache"
18 { preferLocalBuild = true;
19 allowSubstitutes = false;
20 buildInputs = [ pkgs.gtk3 cfg.package ];
23 mkdir -p $out/etc/gtk-3.0/
24 GTK_PATH=${cfg.package}/lib/gtk-3.0/ gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache
31 enable = lib.mkEnableOption "an additional input method type" // {
32 default = cfg.enabled != null;
33 defaultText = lib.literalMD "`true` if the deprecated option `enabled` is set, false otherwise";
36 enabled = lib.mkOption {
37 type = lib.types.nullOr allowedTypes;
40 description = "Deprecated - use `type` and `enable = true` instead";
44 type = lib.types.nullOr allowedTypes;
45 default = cfg.enabled;
46 defaultText = lib.literalMD "The value of the deprecated option `enabled`, defaulting to null";
49 Select the enabled input method. Input methods is a software to input symbols that are not available on standard input devices.
51 Input methods are specially used to input Chinese, Japanese and Korean characters.
53 Currently the following input methods are available in NixOS:
55 - ibus: The intelligent input bus, extra input engines can be added using `i18n.inputMethod.ibus.engines`.
56 - fcitx5: The next generation of fcitx, addons (including engines, dictionaries, skins) can be added using `i18n.inputMethod.fcitx5.addons`.
57 - nabi: A Korean input method based on XIM. Nabi doesn't support Qt 5.
58 - uim: The universal input method, is a library with a XIM bridge. uim mainly support Chinese, Japanese and Korean.
59 - hime: An extremely easy-to-use input method framework.
64 package = lib.mkOption {
66 type = lib.types.nullOr lib.types.path;
69 The input method method package.
75 config = lib.mkIf cfg.enable {
76 warnings = lib.optional (cfg.enabled != null) "i18n.inputMethod.enabled will be removed in a future release. Please use .type, and .enable = true instead";
77 environment.systemPackages = [ cfg.package gtk2_cache gtk3_cache ];
81 maintainers = with lib.maintainers; [ ericsagnes ];