How to setup an Input Method, for CJK users?

When using Gnome, you can use this config:

i18n.inputMethod = {
  enable = true;
  type = "ibus";
  ibus.engines = with pkgs.ibus-engines; [ pinyin ];
};

and then just select Chinese (pinyin) in the gnome settings app under “Keyboard”.