diff options
author | Eric Sagnes <eric.sagnes@gmail.com> | 2015-11-25 16:29:50 +0900 |
---|---|---|
committer | Eric Sagnes <eric.sagnes@gmail.com> | 2016-02-17 20:44:29 +0900 |
commit | 850be632a071c2d7dd2f9bdb333d1fdffbec3340 (patch) | |
tree | ff9544d57dee7c832477b8da6d277bf9d9da9ac6 /nixos | |
parent | a0457135d8e4ea13610f00b26e37fcb7201ceb67 (diff) |
fcitx service: init
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/i18n/inputMethod/fcitx.nix | 51 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 |
2 files changed, 52 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 "<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"; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 8254cdd6f5eb..7375dcde5c5c 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -43,6 +43,7 @@ ./hardware/video/nvidia.nix ./hardware/video/ati.nix ./hardware/video/webcam/facetimehd.nix + ./i18n/inputMethod/fcitx.nix ./installer/tools/auto-upgrade.nix ./installer/tools/nixos-checkout.nix ./installer/tools/tools.nix |