Can't install Fcitx5. syntax error maybe

Hello, I just started NixOS, playing around with it to learn a day ago. I’m trying to add Fcitx5 and I can’t get it to work, it keeps giving me errors. I copied and pasted the config from https://nixos.wiki/wiki/Fcitx5 and It tells me..

error:
       … while evaluating the attribute 'config'
         at /nix/store/4lv1f8kvx16bi3ph1zidbs9gdrnvnikd-nixos-25.11.650.8bb5646e0bed/nixos/lib/modules.nix:361:9:
          360|         options = checked options;
          361|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          362|         _module = checked (config._module);

       … while calling the 'seq' builtin
         at /nix/store/4lv1f8kvx16bi3ph1zidbs9gdrnvnikd-nixos-25.11.650.8bb5646e0bed/nixos/lib/modules.nix:361:18:
          360|         options = checked options;
          361|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          362|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attempt to call something which is not a function but a set: { i18n = «thunk»; }
       at /etc/nixos/configuration.nix:7:1:
            6|
            7| {
             | ^
            8|   i18n.inputMethod = {
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.nixos-rebuild --no-out-link' returned non-zero exit status 1.

I tried the one for unstable and stable. I don’t know why it has a problem with {because i did close it at the end (I copied from the official wiki)

Here is my config-

                                           

{ config, pkgs, ... }:

{
   i18n.inputMethod = {
     type = "fcitx5";
     enable = true;
     fcitx5.addons = with pkgs; [
       fcitx5-gtk             # alternatively, kdePackages.fcitx5-qt
       fcitx5-chinese-addons  # table input method support
       fcitx5-nord            # a color theme
     ];
  };
}

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

 


When I get rid of { it then tells me its got a problem with the =. Someone please respond and help me. I’m trying to type in Chinese, maybe I need another configuration. :smiling_face_with_tear:

Move the imports part into the above attrset. A NixOS module is one big attrset. See the wiki for the structure of NixOS modules: https://wiki.nixos.org/wiki/NixOS_modules

1 Like

I think I understand now, thank you