nixos/fcitx5: add the setting of RIME_DATA_DIR and options for rime-data
This commit is contained in:
parent
6031ae21f6
commit
2474c8c89a
@ -5,7 +5,9 @@ with lib;
|
||||
let
|
||||
im = config.i18n.inputMethod;
|
||||
cfg = im.fcitx5;
|
||||
fcitx5Package = pkgs.fcitx5-with-addons.override { inherit (cfg) addons; };
|
||||
addons = cfg.addons ++ optional cfg.enableRimeData pkgs.rime-data;
|
||||
fcitx5Package = pkgs.fcitx5-with-addons.override { inherit addons; };
|
||||
whetherRimeDataDir = any (p: p.pname == "fcitx5-rime") cfg.addons;
|
||||
in {
|
||||
options = {
|
||||
i18n.inputMethod.fcitx5 = {
|
||||
@ -17,16 +19,29 @@ in {
|
||||
Enabled Fcitx5 addons.
|
||||
'';
|
||||
};
|
||||
|
||||
enableRimeData = mkEnableOption "default rime-data with fcitx5-rime";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (im.enabled == "fcitx5") {
|
||||
i18n.inputMethod.package = fcitx5Package;
|
||||
|
||||
environment.variables = {
|
||||
GTK_IM_MODULE = "fcitx";
|
||||
QT_IM_MODULE = "fcitx";
|
||||
XMODIFIERS = "@im=fcitx";
|
||||
};
|
||||
environment = mkMerge [{
|
||||
variables = {
|
||||
GTK_IM_MODULE = "fcitx";
|
||||
QT_IM_MODULE = "fcitx";
|
||||
XMODIFIERS = "@im=fcitx";
|
||||
};
|
||||
}
|
||||
(mkIf whetherRimeDataDir {
|
||||
pathsToLink = [
|
||||
"/share/rime-data"
|
||||
];
|
||||
|
||||
variables = {
|
||||
NIX_RIME_DATA_DIR = "/run/current-system/sw/share/rime-data";
|
||||
};
|
||||
})];
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user