2021-06-16 00:59:25 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.i18n.inputMethod;
|
|
|
|
|
|
|
|
gtk2Cache = pkgs.runCommandLocal "gtk2-immodule.cache" {
|
|
|
|
buildInputs = [ pkgs.gtk2 cfg.package ];
|
|
|
|
} ''
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
gtk3Cache = pkgs.runCommandLocal "gtk3-immodule.cache" {
|
|
|
|
buildInputs = [ pkgs.gtk3 cfg.package ];
|
|
|
|
} ''
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
in {
|
2023-03-25 15:32:31 +01:00
|
|
|
imports = [ ./fcitx5.nix ./hime.nix ./kime.nix ./nabi.nix ./uim.nix ];
|
2021-06-16 00:59:25 +02:00
|
|
|
|
|
|
|
options.i18n = {
|
|
|
|
inputMethod = {
|
|
|
|
enabled = mkOption {
|
|
|
|
type = types.nullOr
|
|
|
|
(types.enum [ "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]);
|
|
|
|
default = null;
|
2023-03-25 15:32:31 +01:00
|
|
|
example = "fcitx5";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-07-01 02:40:42 +02:00
|
|
|
Select the enabled input method. Input methods are software to input
|
2021-06-16 00:59:25 +02:00
|
|
|
symbols that are not available on standard input devices.
|
2023-07-01 02:40:42 +02:00
|
|
|
|
|
|
|
Input methods are especially used to input Chinese, Japanese and
|
|
|
|
Korean characters.
|
|
|
|
|
2021-06-16 00:59:25 +02:00
|
|
|
Currently the following input methods are available in Home Manager:
|
|
|
|
|
2023-07-01 02:40:42 +02:00
|
|
|
`fcitx5`
|
|
|
|
: A customizable lightweight input method.
|
|
|
|
The next generation of fcitx.
|
|
|
|
Addons (including engines, dictionaries, skins) can be added using
|
|
|
|
[](#opt-i18n.inputMethod.fcitx5.addons).
|
|
|
|
|
|
|
|
`nabi`
|
|
|
|
: A Korean input method based on XIM. Nabi doesn't support Qt 5.
|
|
|
|
|
|
|
|
`uim`
|
|
|
|
: The "universal input method" is a library with an XIM bridge.
|
|
|
|
uim mainly supports Chinese, Japanese and Korean.
|
|
|
|
|
|
|
|
`hime`
|
|
|
|
: An extremely easy-to-use input method framework.
|
|
|
|
|
|
|
|
`kime`
|
|
|
|
: A Korean IME.
|
2021-06-16 00:59:25 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
internal = true;
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-06-16 00:59:25 +02:00
|
|
|
The input method method package.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf (cfg.enabled != null) {
|
2021-07-07 23:24:27 +02:00
|
|
|
assertions = [
|
|
|
|
(hm.assertions.assertPlatform "i18n.inputMethod" pkgs platforms.linux)
|
2023-03-25 15:32:31 +01:00
|
|
|
{
|
|
|
|
assertion = cfg.enabled != "fcitx";
|
|
|
|
message = "fcitx has been removed, please use fcitx5 instead";
|
|
|
|
}
|
2021-07-07 23:24:27 +02:00
|
|
|
];
|
|
|
|
|
2021-06-16 00:59:25 +02:00
|
|
|
home.packages = [ cfg.package gtk2Cache gtk3Cache ];
|
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = with lib; [ hm.maintainers.kranzes ];
|
|
|
|
}
|