fcitx5/mozc/Japanese: Declarative Profile Configuration Not Working

As part of the process of setting up impermanence, I’m trying to have my fcitx5/mozc setup for Japanese/Swiss German input on a Swiss German keyboard declared in my NixOS configuration. When I then build a fresh VM including the configuration below and try to boot into it, I have a broken configuration. Only the mozc input (as the Off Input Method) is listed in the input configuration GUI and available from the taskbar. I am only able to type in Japanese.

image

  # Configure keymap in X11
  services.xserver = {
    layout = "ch";
    xkbVariant = "";
  };

  # Configure console keymap
  console.keyMap = "sg";
  i18n.inputMethod = {
      enabled = "fcitx5";
      fcitx5.ignoreUserConfig = true;
      fcitx5.addons = with pkgs; [
          fcitx5-mozc
          fcitx5-gtk
      ];
      fcitx5.settings.inputMethod = {
        "Groups/0" = {
          "Name" = "Default";
          "Default Layout" = "ch";
          "DefaultIM" = "mozc";
        };
        "Groups/0/Items/0" = {
          "Name" = "keybord-ch";
          "Layout" = null;
        };
        "Groups/0/Items/1" = {
          "Name" = "mozc";
          "Layout" = null;
        };
        "GroupOrder" = {
          "0" = "Default";
        };
      };
  };

In reality, the mozc input method and Swiss German input methods should be available as they are on my main system where I configured them by hand:

image

The contents .config/fcitx5/profile on my working, manually configured system is as follows:

[nicholas@nixos:~]$ cat .config/fcitx5/profile 
[Groups/0]
# Group Name
Name="Group 2"
# Layout
Default Layout=ch
# Default Input Method
DefaultIM=mozc

[Groups/0/Items/0]
# Name
Name=keyboard-ch
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=mozc
# Layout
Layout=

[Groups/1]
# Group Name
Name="Group 1"
# Layout
Default Layout=ch
# Default Input Method
DefaultIM=mozc

[Groups/1/Items/0]
# Name
Name=keyboard-ch
# Layout
Layout=

[Groups/1/Items/1]
# Name
Name=mozc
# Layout
Layout=

[GroupOrder]
0="Group 2"
1="Group 1"

I only need 1 of the two groups.

There is very little documentation or code samples for how to set this up properly. Any help would be greatly appreciated.

2 Likes