環境:NixOS 25.05 + KDE 6 + Wayland
用 configuration.nix ,設定:
{ config, pkgs, ... }:
{
i18n.inputMethod = {
# NixOS 24.11 起的用法
enable = true;
type = "fcitx5";
fcitx5 = {
plasma6Support = true;
waylandFrontend = true;
ignoreUserConfig = true; # 吃下面的 settings,不用 user 的
addons = with pkgs; [
fcitx5-chewing # 新酷音
fcitx5-chinese-addons
fcitx5-mozc # 日文輸入法
];
settings = {
inputMethod = {
"Groups/0" = {
Name = "Default";
"Default Layout" = "us";
DefaultIM = "keyboard-us";
};
"Groups/0/Items/0".Name = "keyboard-us";
"Groups/0/Items/1".Name = "chewing";
"Groups/0/Items/2".Name = "mozc";
};
};
};
};
}
rebuild 跟重開機後就能打中文了!但還是會跳這個訊息:

暫時找不到 NixOS 對應設定的地方,而且~~折騰了一段時間~~也先不搬到 home manager,所以手動照著訊息設定 virtual keyboard。
坑
切換輸入法後出現 Not available
在 environment.systemPackages 不要設定 fcitx5 相關 package,不然在切換到新酷音時會出現 Not available 之類的字樣,也無法輸入中文。(ref)
env var GTK_IM_MODULE 與 QT_IM_MODULE
在 Wayland 底下即使沒 NixOS 跟 home manager 內設定這兩個 env variable,也還是會被設定成 fcitx,所以會一直跳這個訊息:

加上 waylandFrontend = true; 可以讓它別跳了。(ref)
Ref
本文同步發表於:https://www.cjwind.cc/nixos-chinese-input-with-fcitx5/









