# Set layout for X11
services.xserver.layout = "eu";
# Set layout in GNOME
services.xserver.desktopManager.gnome = {
extraGSettingsOverrides = ''
[org.gnome.desktop.input-sources]
sources='[('xkb', 'eu')]'
'';
extraGSettingsOverridePackages = [
pkgs.gsettings-desktop-schemas
];
};
I also tried
sources='[]'
After reboot I get the following:
➜ setxkbmap -query
rules: evdev
model: pc105
layout: us
but running “setxkbmap eu” does only change the behavior for some applications. Terminal and GNOME text editor still have the “us” keyboard while Firefox has the “eu” keyboard.
However GNOME settings shows correct keyboard
➜ gsettings get org.gnome.desktop.input-sources sources
[('xkb', 'eu')]
Can someone who is using GNOME please share his/her keyboard configuration? Thank you.
You should see the following error when building your system:
nixos-gsettings-desktop-schemas> Error parsing key “sources” in schema “org.gnome.desktop.input-sources” as specified in override file “/nix/store/lrq600a2qamr03nq7wg5jl720dl0imqq-nixos-gsettings-desktop-schemas/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/nixos-defaults.gschema.override”: 0-4:can not parse as value of type 'a(ss)'. Ignoring override for this key.
I guess we should make it fail more loudly.
The issue is that you have extra quotes around the array:
It should be just sources=[('xkb', 'eu')].
Also note that the extraGSettingsOverrides mechanism only allows you to set the default value so in order for it to apply, you will need to run gsettings reset org.gnome.desktop.input-sources sources and re-log in.
I would expect the home-manager config to work, though there might be some state weirdness happening from previous stuff you tried. Try adding an extra language sources = [ (mkTuple [ "xkb" "gb" ]) (mkTuple [ "xkb" "eu" ]) ], activating that home-manager config, and then activating the config with just eu layout. Hopefully, that should make gnome-settings-daemon to notice the change. Or just re-log in.
I would avoid using setxkbmap in GNOME since it might go behind gnome-settings-daemon’s back and result in an inconsistent state between the daemon and settings causing a weird behaviour.