mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-19 04:02:10 +00:00
45 lines
1.2 KiB
Nix
45 lines
1.2 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.i18n.inputMethod.fcitx;
|
|
fcitxPackage = pkgs.fcitx.override { plugins = cfg.engines; };
|
|
fcitxEngine = types.package // {
|
|
name = "fcitx-engine";
|
|
check = x: (lib.types.package.check x) && (attrByPath ["meta" "isFcitxEngine"] false x);
|
|
};
|
|
in
|
|
{
|
|
options = {
|
|
|
|
i18n.inputMethod.fcitx = {
|
|
engines = mkOption {
|
|
type = with types; listOf fcitxEngine;
|
|
default = [];
|
|
example = literalExample "with pkgs.fcitx-engines; [ mozc hangul ]";
|
|
description =
|
|
let
|
|
engines =
|
|
lib.concatStringsSep ", "
|
|
(map (name: "<literal>${name}</literal>")
|
|
(lib.attrNames pkgs.fcitx-engines));
|
|
in
|
|
"Enabled Fcitx engines. Available engines are: ${engines}.";
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf (config.i18n.inputMethod.enabled == "fcitx") {
|
|
i18n.inputMethod.package = fcitxPackage;
|
|
|
|
environment.variables = {
|
|
GTK_IM_MODULE = "fcitx";
|
|
QT_IM_MODULE = "fcitx";
|
|
XMODIFIERS = "@im=fcitx";
|
|
};
|
|
services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx";
|
|
};
|
|
}
|