diff options
author | Eric Sagnes <eric.sagnes@gmail.com> | 2016-04-12 19:46:12 +0900 |
---|---|---|
committer | Eric Sagnes <eric.sagnes@gmail.com> | 2016-04-12 19:50:26 +0900 |
commit | e6ae05dd8ac9e42b1394701b65452e1e9cef6529 (patch) | |
tree | 5ec6ac166f5a68c2523ee6818058a281fc81b3ca /nixos/modules/i18n/input-method/fcitx.nix | |
parent | de78fe8f2d78a5ef20d0d355c5dbe9d21b4be22c (diff) | |
download | nixlib-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar nixlib-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.gz nixlib-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.bz2 nixlib-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.lz nixlib-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.xz nixlib-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.tar.zst nixlib-e6ae05dd8ac9e42b1394701b65452e1e9cef6529.zip |
input-method module: fix folder case
Diffstat (limited to 'nixos/modules/i18n/input-method/fcitx.nix')
-rw-r--r-- | nixos/modules/i18n/input-method/fcitx.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/nixos/modules/i18n/input-method/fcitx.nix b/nixos/modules/i18n/input-method/fcitx.nix new file mode 100644 index 000000000000..8e31743504f1 --- /dev/null +++ b/nixos/modules/i18n/input-method/fcitx.nix @@ -0,0 +1,44 @@ +{ 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 = { + engines = mkOption { + type = with types; listOf fcitxEngine; + default = []; + example = literalExample "with pkgs.fcitx-engines; [ mozc hangul ]"; + description = + let + engines = + lib.concatStringsSep ", " + (map (name: "<literal>${name}</literal>") + (lib.attrNames pkgs.fcitx-engines)); + in + "Enabled Fcitx engines. Available engines are: ${engines}."; + }; + }; + + }; + + config = mkIf (config.i18n.inputMethod.enabled == "fcitx") { + environment.systemPackages = [ fcitxPackage ]; + + environment.variables = { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + }; + services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx"; + }; +} |