(Note: I’m currently migrating from Debian to NixOS. On Debian, I was able to configure all of this without any issues, but I’m struggling to replicate the setup on NixOS.)
Hello NixOS community,
I’ve been trying to set up multiple input methods:
- English (US, alt. intl.)
- Intelligent Pinyin
- Hanyu Pinyin (m17n))
Using IBus on NixOS with the i3wm window manager. Despite several attempts and following guides, I haven’t been able to get it working properly. Below, I’ll detail my configuration, the steps I’ve taken, and the issues I’ve encountered. Any help or guidance would be greatly appreciated!
My Configuration
Here is my current configuration.nix
file:
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
boot.loader.grub.useOSProber = true;
boot.initrd.luks.devices."luks-88b58d23-5c3d-498e-b81c-ec9e6ed7df91".device = "/dev/disk/by-uuid/88b58d23-5c3d-498e-b81c-ec9e6ed7df91";
# Setup keyfile
boot.initrd.secrets = {
"/boot/crypto_keyfile.bin" = null;
};
boot.loader.grub.enableCryptodisk = true;
boot.initrd.luks.devices."luks-7b609c9a-b9bf-40ff-b01a-11cd7894f138".keyFile = "/boot/crypto_keyfile.bin";
boot.initrd.luks.devices."luks-88b58d23-5c3d-498e-b81c-ec9e6ed7df91".keyFile = "/boot/crypto_keyfile.bin";
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Sao_Paulo";
# Select internationalisation properties.
i18n = {
defaultLocale = "en_US.UTF-8";
supportedLocales = [
"en_US.UTF-8/UTF-8"
"zh_CN.UTF-8/UTF-8" # Se você precisar de suporte ao chinês
];
};
i18n.inputMethod = {
enable = true;
type = "ibus";
ibus.engines = with pkgs.ibus-engines; [
libpinyin
m17n
];
};
environment.variables = {
GTK_IM_MODULE = "ibus";
QT_IM_MODULE = "ibus";
XMODIFIERS = "@im=ibus";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
};
i18n.extraLocaleSettings = {
LC_ADDRESS = "pt_BR.UTF-8";
LC_IDENTIFICATION = "pt_BR.UTF-8";
LC_MEASUREMENT = "pt_BR.UTF-8";
LC_MONETARY = "pt_BR.UTF-8";
LC_NAME = "pt_BR.UTF-8";
LC_NUMERIC = "pt_BR.UTF-8";
LC_PAPER = "pt_BR.UTF-8";
LC_TELEPHONE = "pt_BR.UTF-8";
LC_TIME = "pt_BR.UTF-8";
};
# Enable the X11 windowing system.
#services.xserver.enable = true;
services.xserver = {
enable = true;
desktopManager = {xterm.enable=false;};
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu
i3status
i3lock
i3blocks
];
};
};
services.displayManager = {
defaultSession = "none+i3";
};
#services.xserver.enable = true;
services.xserver.windowManager.i3.package = pkgs.i3-gaps;
programs.dconf.enable = true;
# Enable the XFCE Desktop Environment.
services.xserver.displayManager.lightdm = {
enable = true;
};
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "alt-intl";
};
# Configure console keymap
console.keyMap = "dvorak";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.alexandre = {
isNormalUser = true;
description = "Alexandre";
extraGroups = [ "networkmanager" "wheel" "docker"];
packages = with pkgs; [
# thunderbird
];
};
users.defaultUserShell=pkgs.zsh;
# Install firefox.
programs.firefox.enable = true;
# enable zsh and oh my zsh
programs = {
zsh = {
enable = true;
autosuggestions.enable = true;
zsh-autoenv.enable = true;
syntaxHighlighting.enable = true;
ohMyZsh = {
enable = true;
plugins = [
"git"
"history"
];
};
};
};
# Install Steam
programs.steam.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim
gnupg
git
wget
brave
alacritty
nitrogen
arandr
discord
jetbrains.idea-ultimate
rofi
xfce.thunar
xfce.thunar-volman
xfce.thunar-archive-plugin
lxappearance
zsh
papirus-icon-theme
localsend
bitwarden-desktop
flatpak
dunst
maven
docker-client
docker-compose
pgadmin4
neovim
asdf-vm
thefuck
fzf
fzf-git-sh
lazydocker
lazygit
gearlever
krita
ibus
ibus-engines.libpinyin
ibus-engines.m17n
libpinyin
xournalpp
#protonvpn-gui
awscli2
flameshot
];
# List services that you want to enable:
virtualisation.docker.enable = true;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
system.stateVersion = "24.11"; # Did you read the comment?
}
Steps Taken
1. Configured Locales
I ensured that both en_US.UTF-8
and zh_CN.UTF-8
are included in i18n.supportedLocales
. After rebuilding the system, I verified that the locales are installed:
Input:
locale -a
Output:
C
en_US.utf8
zh_CN.utf8
POSIX
2. Enabled IBus and Added Engines
I enabled IBus as the input method and added the required engines (libpinyin
and m17n
) in i18n.inputMethod.ibus.engines
.
3. Set Environment Variables
I exported the necessary environment variables (GTK_IM_MODULE
, QT_IM_MODULE
, XMODIFIERS
, etc.) both globally in environment.variables
and locally in ~/.xprofile
:
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
ibus-daemon -drx &
4. Restarted i3wm
After applying the changes, I restarted i3wm and tried to start IBus manually:
ibus-daemon -drx
However, IBus does not seem to connect properly, and I only have the English (US, alt. intl.) input method available.
Current Issues
Missing Input Methods : Only the English (US, alt. intl.) input method is available. Intelligent Pinyin and Hanyu Pinyin (m17n) do not appear in the IBus settings.
Questions
- How can I ensure that IBus starts correctly with i3wm?
- Why are the additional input methods (Intelligent Pinyin and Hanyu Pinyin) not appearing in IBus?
Additional Information
- NixOS version: 24.11
- Window manager: i3-gaps
- Display manager: LightDM
- Installed packages:
ibus
,ibus-engines.libpinyin
,ibus-engines.m17n
Any help or suggestions would be greatly appreciated.