3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/i18n/input-method/fcitx5.nix

39 lines
868 B
Nix
Raw Normal View History

2020-12-13 03:29:58 +00:00
{ config, pkgs, lib, ... }:
with lib;
let
im = config.i18n.inputMethod;
cfg = im.fcitx5;
fcitx5Package = pkgs.fcitx5-with-addons.override { inherit (cfg) addons; };
2021-06-02 00:50:11 +01:00
in {
options = {
i18n.inputMethod.fcitx5 = {
addons = mkOption {
type = with types; listOf package;
default = [];
example = literalExpression "with pkgs; [ fcitx5-rime ]";
2021-06-02 00:50:11 +01:00
description = ''
Enabled Fcitx5 addons.
'';
2020-12-13 03:29:58 +00:00
};
};
2021-06-02 00:50:11 +01:00
};
2020-12-13 03:29:58 +00:00
2021-06-02 00:50:11 +01:00
config = mkIf (im.enabled == "fcitx5") {
i18n.inputMethod.package = fcitx5Package;
2020-12-13 03:29:58 +00:00
2021-06-02 00:50:11 +01:00
environment.variables = {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
systemd.user.services.fcitx5-daemon = {
enable = true;
script = "${fcitx5Package}/bin/fcitx5";
wantedBy = [ "graphical-session.target" ];
2020-12-13 03:29:58 +00:00
};
2021-06-02 00:50:11 +01:00
};
}