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

47 lines
1.3 KiB
Nix
Raw Normal View History

2015-11-25 07:29:50 +00:00
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.i18n.inputMethod.fcitx;
2016-07-11 16:50:22 +01:00
fcitxPackage = pkgs.fcitx.override { plugins = cfg.engines; };
2015-11-25 07:29:50 +00:00
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 = literalExpression "with pkgs.fcitx-engines; [ mozc hangul ]";
description =
let
enginesDrv = filterAttrs (const isDerivation) pkgs.fcitx-engines;
engines = concatStringsSep ", "
(map (name: "<literal>${name}</literal>") (attrNames enginesDrv));
in
"Enabled Fcitx engines. Available engines are: ${engines}.";
2015-11-25 07:29:50 +00:00
};
};
};
2016-02-16 14:10:46 +00:00
config = mkIf (config.i18n.inputMethod.enabled == "fcitx") {
2016-04-04 10:11:20 +01:00
i18n.inputMethod.package = 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";
};
# uses attributes of the linked package
meta.buildDocsInSandbox = false;
2015-11-25 07:29:50 +00:00
}