Fcitx not working on gnome

NixOS Version: 20.03. The packages are freshly installed. (I am new to Nix and NixOS.) Gnome is using wayland, but I am not sure if this is related.

Fcitx works out of the box on Xfce and KDE Plasma, but not for gnome. No input method icon on the top bar of the desktop, and not in the input source in Region & Language settings. On the other hand, Ibus works but I cannot get it to work on applications like firefox or kitty terminal etc.

My Configuration:

i18n.inputMethod = {
  enabled = "fcitx";
  fcitx.engines = with pkgs.fcitx-engines; [ rime cloudpinyin];
};

fcitx-diagnose output: https://pastebin.com/X1DdgxHd
It should be fine as I’ve set the environment variables using ~/.pam_environment.

Another question regarding desktop manager. Not sure if I should create another topic…
In fact I want to use Xfce, but for some reasons it cannot detect my external monitor via HDMI cable.
Here is my lspci | grep 'VGA\|3D' output:

00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)

Gnome and GDM can work without enabling the nvidia proprietary driver, so it should not be an issue with optimus prime. If the proprietary driver is enabled with optimus prime, Gnome, Xfce and KDE Plasma would fail, either blank screen or the something has gone wrong screen for Gnome.