2015-11-25 07:29:50 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.i18n.inputMethod.fcitx;
|
|
|
|
fcitxPackage = pkgs.fcitx-with-plugins.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 = ''
|
|
|
|
Enabled Fcitx engines.
|
|
|
|
Available engines can be found by running `nix-env "<nixpkgs>" . -qaP -A fcitx-engines`.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-02-16 14:10:46 +00:00
|
|
|
config = mkIf (config.i18n.inputMethod.enabled == "fcitx") {
|
2015-11-25 07:29:50 +00:00
|
|
|
environment.systemPackages = [ fcitxPackage ];
|
|
|
|
gtkPlugins = [ fcitxPackage ];
|
2016-02-10 05:00:58 +00:00
|
|
|
qtPlugins = [ fcitxPackage ];
|
2015-11-25 07:29:50 +00:00
|
|
|
|
|
|
|
environment.variables = {
|
|
|
|
GTK_IM_MODULE = "fcitx";
|
|
|
|
QT_IM_MODULE = "fcitx";
|
|
|
|
XMODIFIERS = "@im=fcitx";
|
|
|
|
};
|
|
|
|
services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx";
|
|
|
|
};
|
|
|
|
}
|