2016-02-16 23:10:46 +09:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2016-04-04 18:11:20 +09:00
|
|
|
let
|
|
|
|
cfg = config.i18n.inputMethod;
|
2016-09-27 15:26:37 +02:00
|
|
|
|
2024-08-24 22:05:32 +02:00
|
|
|
allowedTypes = lib.types.enum [
|
|
|
|
"ibus"
|
|
|
|
"fcitx5"
|
|
|
|
"nabi"
|
|
|
|
"uim"
|
|
|
|
"hime"
|
|
|
|
"kime"
|
|
|
|
];
|
2024-05-10 19:46:04 +12:00
|
|
|
|
2016-09-27 15:26:37 +02:00
|
|
|
gtk2_cache =
|
|
|
|
pkgs.runCommand "gtk2-immodule.cache"
|
|
|
|
{
|
|
|
|
preferLocalBuild = true;
|
|
|
|
allowSubstitutes = false;
|
|
|
|
buildInputs = [
|
|
|
|
pkgs.gtk2
|
|
|
|
cfg.package
|
|
|
|
];
|
|
|
|
}
|
|
|
|
''
|
2016-04-04 18:11:20 +09:00
|
|
|
mkdir -p $out/etc/gtk-2.0/
|
|
|
|
GTK_PATH=${cfg.package}/lib/gtk-2.0/ gtk-query-immodules-2.0 > $out/etc/gtk-2.0/immodules.cache
|
|
|
|
'';
|
2016-09-27 15:26:37 +02:00
|
|
|
|
|
|
|
gtk3_cache =
|
|
|
|
pkgs.runCommand "gtk3-immodule.cache"
|
|
|
|
{
|
|
|
|
preferLocalBuild = true;
|
|
|
|
allowSubstitutes = false;
|
|
|
|
buildInputs = [
|
|
|
|
pkgs.gtk3
|
|
|
|
cfg.package
|
|
|
|
];
|
|
|
|
}
|
|
|
|
''
|
2016-04-04 18:11:20 +09:00
|
|
|
mkdir -p $out/etc/gtk-3.0/
|
|
|
|
GTK_PATH=${cfg.package}/lib/gtk-3.0/ gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache
|
|
|
|
'';
|
2016-09-27 15:26:37 +02:00
|
|
|
|
2016-04-04 18:11:20 +09:00
|
|
|
in
|
2016-02-16 23:10:46 +09:00
|
|
|
{
|
2016-04-04 18:11:20 +09:00
|
|
|
options.i18n = {
|
|
|
|
inputMethod = {
|
2024-08-24 22:05:32 +02:00
|
|
|
enable = lib.mkEnableOption "an additional input method type" // {
|
2024-05-10 19:46:04 +12:00
|
|
|
default = cfg.enabled != null;
|
2024-08-24 22:05:32 +02:00
|
|
|
defaultText = lib.literalMD "`true` if the deprecated option `enabled` is set, false otherwise";
|
2024-05-10 19:46:04 +12:00
|
|
|
};
|
|
|
|
|
2024-08-24 22:05:32 +02:00
|
|
|
enabled = lib.mkOption {
|
|
|
|
type = lib.types.nullOr allowedTypes;
|
2016-02-16 23:10:46 +09:00
|
|
|
default = null;
|
2023-03-12 12:03:50 +08:00
|
|
|
example = "fcitx5";
|
2024-05-10 19:46:04 +12:00
|
|
|
description = "Deprecated - use `type` and `enable = true` instead";
|
|
|
|
};
|
|
|
|
|
2024-08-24 22:05:32 +02:00
|
|
|
type = lib.mkOption {
|
|
|
|
type = lib.types.nullOr allowedTypes;
|
2024-05-10 19:46:04 +12:00
|
|
|
default = cfg.enabled;
|
2024-08-24 22:05:32 +02:00
|
|
|
defaultText = lib.literalMD "The value of the deprecated option `enabled`, defaulting to null";
|
2024-05-10 19:46:04 +12:00
|
|
|
example = "fcitx5";
|
2016-02-16 23:10:46 +09:00
|
|
|
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`.
|
2021-01-18 18:58:25 +08:00
|
|
|
- fcitx5: The next generation of fcitx, addons (including engines, dictionaries, skins) can be added using `i18n.inputMethod.fcitx5.addons`.
|
2016-02-16 23:10:46 +09:00
|
|
|
- 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.
|
2020-09-17 00:01:57 +08:00
|
|
|
- hime: An extremely easy-to-use input method framework.
|
2021-04-18 00:31:42 +09:00
|
|
|
- kime: Koream IME.
|
2016-02-16 23:10:46 +09:00
|
|
|
'';
|
|
|
|
};
|
2016-04-04 18:11:20 +09:00
|
|
|
|
2024-08-24 22:05:32 +02:00
|
|
|
package = lib.mkOption {
|
2016-04-04 18:11:20 +09:00
|
|
|
internal = true;
|
2024-08-24 22:05:32 +02:00
|
|
|
type = lib.types.nullOr lib.types.path;
|
2016-04-04 18:11:20 +09:00
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
The input method method package.
|
|
|
|
'';
|
|
|
|
};
|
2025-04-24 21:25:26 +08:00
|
|
|
|
|
|
|
enableGtk2 = lib.mkEnableOption "Gtk2 support";
|
|
|
|
|
|
|
|
enableGtk3 = lib.mkEnableOption "Gtk3 support" // {
|
|
|
|
default = true;
|
|
|
|
};
|
2016-02-16 23:10:46 +09:00
|
|
|
};
|
|
|
|
};
|
2016-04-04 18:11:20 +09:00
|
|
|
|
2024-08-24 22:05:32 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
warnings =
|
|
|
|
lib.optional (cfg.enabled != null)
|
|
|
|
"i18n.inputMethod.enabled will be removed in a future release. Please use .type, and .enable = true instead";
|
2025-04-24 21:25:26 +08:00
|
|
|
environment.systemPackages =
|
|
|
|
[
|
|
|
|
cfg.package
|
|
|
|
]
|
|
|
|
++ lib.optional cfg.enableGtk2 gtk2_cache
|
|
|
|
++ lib.optional cfg.enableGtk3 gtk3_cache;
|
2016-04-04 18:11:20 +09:00
|
|
|
};
|
|
|
|
|
2016-05-09 14:53:27 +09:00
|
|
|
meta = {
|
2025-04-17 12:15:49 +02:00
|
|
|
maintainers = with lib.maintainers; [ ];
|
2023-01-25 00:33:40 +01:00
|
|
|
doc = ./default.md;
|
2016-05-09 14:53:27 +09:00
|
|
|
};
|
|
|
|
|
2016-02-16 23:10:46 +09:00
|
|
|
}
|