aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/i18n
diff options
context:
space:
mode:
authorEric Sagnes <eric.sagnes@gmail.com>2015-11-25 16:29:50 +0900
committerEric Sagnes <eric.sagnes@gmail.com>2016-02-17 20:44:29 +0900
commit850be632a071c2d7dd2f9bdb333d1fdffbec3340 (patch)
treeff9544d57dee7c832477b8da6d277bf9d9da9ac6 /nixos/modules/i18n
parenta0457135d8e4ea13610f00b26e37fcb7201ceb67 (diff)
fcitx service: init
Diffstat (limited to 'nixos/modules/i18n')
-rw-r--r--nixos/modules/i18n/inputMethod/fcitx.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/nixos/modules/i18n/inputMethod/fcitx.nix b/nixos/modules/i18n/inputMethod/fcitx.nix
new file mode 100644
index 000000000000..16fa8c764a87
--- /dev/null
+++ b/nixos/modules/i18n/inputMethod/fcitx.nix
@@ -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 "&lt;nixpkgs&gt;" . -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";
+ };
+}