mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
fcitx service: init
This commit is contained in:
parent
a0457135d8
commit
850be632a0
8 changed files with 96 additions and 35 deletions
51
nixos/modules/i18n/inputMethod/fcitx.nix
Normal file
51
nixos/modules/i18n/inputMethod/fcitx.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ 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 = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Enable Fcitx input method.
|
||||
Fcitx can be used to input of Chinese, Korean, Japanese and other special characters.
|
||||
'';
|
||||
};
|
||||
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`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ fcitxPackage ];
|
||||
gtkPlugins = [ fcitxPackage ];
|
||||
qtPlugins = [ fcitxPackage pkgs.kde5.fcitx-qt5 ];
|
||||
|
||||
environment.variables = {
|
||||
GTK_IM_MODULE = "fcitx";
|
||||
QT_IM_MODULE = "fcitx";
|
||||
XMODIFIERS = "@im=fcitx";
|
||||
};
|
||||
services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx";
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue