How to setup an Input Method, for CJK users?

Hello, I’m new to NixOS, is there any example configuration.nix to reference?

I have a blog post where I describe how to setup NixOS for Japanese input:

Some small things may need to be changed if you are using a more recent version of nixpkgs, or if you use a different IME or language. However, this should get you off to a good start.

If you end up getting something working for you, I urge you to share it here so other people searching for something similar can find it.

5 Likes

Thank you, I find it is not so hard after some trial, only two line of configuration is required:

i18n.inputMethod.enabled = "ibus";
i18n.inputMethod.ibus.engines = with pkgs.ibus-engines; [ libpinyin ];

That works, and I need to go to ibus preferences to configure things via GUI, but the personal configuration is not removed after nixos-rebuild, so that’s acceptable.

Hoping there is an example about how to configure all things via configuration.nix

1 Like

Some configuration is “per user” and no way to configure from configuration.nix. For fcitx 3 things are required:

  1. fcitx and associated packages
  2. fcitx launch.
  3. per user config

For 1 & 3, see fcitx: Add test (Unicode input, table input, m17n) by asdf8dfafjk · Pull Request #96371 · NixOS/nixpkgs · GitHub
(The nix stuff goes in my configuration.nix and the fcitx config in my dotfiles)

For 2) if you use startx add “fcitx” to your .xinitrc. I believe most login managers automatically start input method program.