1{ config, pkgs, lib, ... }:
2
3with lib;
4
5let
6 im = config.i18n.inputMethod;
7 cfg = im.fcitx5;
8 fcitx5Package = pkgs.fcitx5-with-addons.override { inherit (cfg) addons; };
9in
10 {
11 options = {
12 i18n.inputMethod.fcitx5 = {
13 addons = mkOption {
14 type = with types; listOf package;
15 default = [];
16 example = with pkgs; [ fcitx5-rime ];
17 description = ''
18 Enabled Fcitx5 addons.
19 '';
20 };
21 };
22 };
23
24 config = mkIf (im.enabled == "fcitx5") {
25 i18n.inputMethod.package = fcitx5Package;
26
27 environment.variables = {
28 GTK_IM_MODULE = "fcitx";
29 QT_IM_MODULE = "fcitx";
30 XMODIFIERS = "@im=fcitx";
31 };
32 };
33 }