2021-04-22 02:08:21 +00:00
|
|
|
{ config, pkgs, lib, generators, ... }:
|
2024-07-27 06:49:29 +00:00
|
|
|
let
|
|
|
|
imcfg = config.i18n.inputMethod;
|
2023-02-02 18:25:31 +00:00
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
(lib.mkRemovedOptionModule [ "i18n" "inputMethod" "kime" "config" ] "Use i18n.inputMethod.kime.* instead")
|
|
|
|
];
|
2021-04-22 02:08:21 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
options.i18n.inputMethod.kime = {
|
|
|
|
daemonModules = lib.mkOption {
|
|
|
|
type = lib.types.listOf (lib.types.enum [ "Xim" "Wayland" "Indicator" ]);
|
|
|
|
default = [ "Xim" "Wayland" "Indicator" ];
|
|
|
|
example = [ "Xim" "Indicator" ];
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2023-02-02 18:25:31 +00:00
|
|
|
List of enabled daemon modules
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
iconColor = lib.mkOption {
|
|
|
|
type = lib.types.enum [ "Black" "White" ];
|
|
|
|
default = "Black";
|
|
|
|
example = "White";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2023-02-02 18:25:31 +00:00
|
|
|
Color of the indicator icon
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
extraConfig = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
|
|
|
default = "";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2023-02-02 18:25:31 +00:00
|
|
|
extra kime configuration. Refer to <https://github.com/Riey/kime/blob/v${pkgs.kime.version}/docs/CONFIGURATION.md> for details on supported values.
|
|
|
|
'';
|
2021-04-22 02:08:21 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
config = lib.mkIf (imcfg.enable && imcfg.type == "kime") {
|
2021-04-22 02:08:21 +00:00
|
|
|
i18n.inputMethod.package = pkgs.kime;
|
|
|
|
|
|
|
|
environment.variables = {
|
|
|
|
GTK_IM_MODULE = "kime";
|
|
|
|
QT_IM_MODULE = "kime";
|
|
|
|
XMODIFIERS = "@im=kime";
|
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
environment.etc."xdg/kime/config.yaml".text = ''
|
|
|
|
daemon:
|
|
|
|
modules: [${lib.concatStringsSep "," imcfg.kime.daemonModules}]
|
|
|
|
indicator:
|
|
|
|
icon_color: ${imcfg.kime.iconColor}
|
|
|
|
'' + imcfg.kime.extraConfig;
|
2021-04-22 02:08:21 +00:00
|
|
|
};
|
|
|
|
|
2022-01-07 04:07:37 +00:00
|
|
|
# uses attributes of the linked package
|
|
|
|
meta.buildDocsInSandbox = false;
|
|
|
|
}
|