diff options
author | Poscat <poscat@mail.poscat.moe> | 2020-12-13 11:29:58 +0800 |
---|---|---|
committer | Poscat <poscat@mail.poscat.moe> | 2021-01-10 14:31:08 +0800 |
commit | 14227a94b2a4b83151aae803adae6766af9f2b3f (patch) | |
tree | d027099e9ff03c02defb1856c6488c4ec5d1f83f | |
parent | 1b06ca4b0d74a0d04e64896a7b38c95e2cfc77ac (diff) | |
download | nixpkgs-14227a94b2a4b83151aae803adae6766af9f2b3f.tar nixpkgs-14227a94b2a4b83151aae803adae6766af9f2b3f.tar.gz nixpkgs-14227a94b2a4b83151aae803adae6766af9f2b3f.tar.bz2 nixpkgs-14227a94b2a4b83151aae803adae6766af9f2b3f.tar.lz nixpkgs-14227a94b2a4b83151aae803adae6766af9f2b3f.tar.xz nixpkgs-14227a94b2a4b83151aae803adae6766af9f2b3f.tar.zst nixpkgs-14227a94b2a4b83151aae803adae6766af9f2b3f.zip |
nixos/input-methods: add fcitx5
-rw-r--r-- | nixos/modules/i18n/input-method/default.nix | 2 | ||||
-rw-r--r-- | nixos/modules/i18n/input-method/fcitx5.nix | 33 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 |
3 files changed, 35 insertions, 1 deletions
diff --git a/nixos/modules/i18n/input-method/default.nix b/nixos/modules/i18n/input-method/default.nix index 0d6dd3399bf..2e7cfaab7b7 100644 --- a/nixos/modules/i18n/input-method/default.nix +++ b/nixos/modules/i18n/input-method/default.nix @@ -29,7 +29,7 @@ in options.i18n = { inputMethod = { enabled = mkOption { - type = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" "hime" ]); + type = types.nullOr (types.enum [ "ibus" "fcitx" "fcitx5" "nabi" "uim" "hime" ]); default = null; example = "fcitx"; description = '' diff --git a/nixos/modules/i18n/input-method/fcitx5.nix b/nixos/modules/i18n/input-method/fcitx5.nix new file mode 100644 index 00000000000..44962d202fe --- /dev/null +++ b/nixos/modules/i18n/input-method/fcitx5.nix @@ -0,0 +1,33 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + im = config.i18n.inputMethod; + cfg = im.fcitx5; + fcitx5Package = pkgs.fcitx5-with-addons.override { inherit (cfg) addons; }; +in + { + options = { + i18n.inputMethod.fcitx5 = { + addons = mkOption { + type = with types; listOf package; + default = []; + example = with pkgs; [ fcitx5-rime ]; + description = '' + Enabled Fcitx5 addons. + ''; + }; + }; + }; + + config = mkIf (im.enabled == "fcitx5") { + i18n.inputMethod.package = fcitx5Package; + + environment.variables = { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + }; + }; + } diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 8fd5d4519fd..9cd27d50f18 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -82,6 +82,7 @@ ./hardware/xpadneo.nix ./i18n/input-method/default.nix ./i18n/input-method/fcitx.nix + ./i18n/input-method/fcitx5.nix ./i18n/input-method/hime.nix ./i18n/input-method/ibus.nix ./i18n/input-method/nabi.nix |