2015-11-25 08:29:50 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.i18n.inputMethod.fcitx;
|
2016-07-11 17:50:22 +02:00
|
|
|
fcitxPackage = pkgs.fcitx.override { plugins = cfg.engines; };
|
2015-11-25 08:29:50 +01: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 = [];
|
2021-10-03 18:06:03 +02:00
|
|
|
example = literalExpression "with pkgs.fcitx-engines; [ mozc hangul ]";
|
2016-02-27 13:20:19 +01:00
|
|
|
description =
|
|
|
|
let
|
2016-09-06 15:53:15 +02:00
|
|
|
enginesDrv = filterAttrs (const isDerivation) pkgs.fcitx-engines;
|
|
|
|
engines = concatStringsSep ", "
|
2022-07-20 12:32:04 +02:00
|
|
|
(map (name: "`${name}`") (attrNames enginesDrv));
|
2016-02-27 13:20:19 +01:00
|
|
|
in
|
2022-07-20 12:32:04 +02:00
|
|
|
lib.mdDoc "Enabled Fcitx engines. Available engines are: ${engines}.";
|
2015-11-25 08:29:50 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-02-16 15:10:46 +01:00
|
|
|
config = mkIf (config.i18n.inputMethod.enabled == "fcitx") {
|
2016-04-04 11:11:20 +02:00
|
|
|
i18n.inputMethod.package = fcitxPackage;
|
2015-11-25 08:29:50 +01:00
|
|
|
|
|
|
|
environment.variables = {
|
|
|
|
GTK_IM_MODULE = "fcitx";
|
|
|
|
QT_IM_MODULE = "fcitx";
|
|
|
|
XMODIFIERS = "@im=fcitx";
|
|
|
|
};
|
|
|
|
services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx";
|
|
|
|
};
|
2021-11-19 00:26:27 +01:00
|
|
|
|
|
|
|
# uses attributes of the linked package
|
|
|
|
meta.buildDocsInSandbox = false;
|
2015-11-25 08:29:50 +01:00
|
|
|
}
|