localectl (apparently part of systemd) looks in /usr/share/X11/xkb for keyboard definitions, not /etc/X11/xkb' or '/nix/store/.../.
$ localectl list-x11-keymap-options
Failed to open keyboard mapping list. No such file or directory
$ strace localectl list-x11-keymap-options |& grep xkb
open("/usr/share/X11/xkb/rules/base.lst", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
Can confirm on a recent nixos-unstable (17.03.git.5bf15b0 (Gorilla)). My guess is that it's something to do with e7ded267bd39f8509c7c4ab2927c6aec9d567540, so I'll look into that. Removing patches seems like a bad thing, since I rely on patches.
Okay, so reverting that commit fixes my issue (that my version of this wasn't working), but I don't know whether it's relevant to you. I still get the same outputs for those commands.
I also came across this on my quest to get my personal keyboard layout working, but didn't run into your problem. And yeah, that patch doesn't look like it's the culprit here.
Have these commands worked previously? If not, I'll open a separate issue.
It probably has not worked before my patch: localectl source
Fixing this to read from /etc/X11/xkb/.. should be straight forward.
Having systemd depend on xkb seems like a bad idea to me.
Agreed on all points. I'll put together a patch if noone else does it first.
@imuli (just in case): we maintain a fork of systemd at http://github.com/NixOS/systemd .
Please submit the patch as a pr over there :+1:
I'm closing this as it'll be fixed by NixOS/systemd#8 eventually.
Is there any way to prod someone into merging that? Maybe this issue should be kept open until that is done.
on master, seems it is still failing
localectl ~/gpgme
System Locale: LANG=fr_FR.UTF-8
VC Keymap: fr
X11 Layout: us,fr
X11 Model: pc104
X11 Options: eurosign:e
teto@jedha> localectl list-keymaps
Failed to read list of keymaps: No such file or directory
[1] teto@jedha> localectl list-locales
teto@jedha> localectl list-x11-keymap-models
Failed to open keyboard mapping list. No such file or directory
@teto You need services.xserver.exportConfiguration = true; in your nixos configuration, which will make sure /etc/X11/xkb is populated.
So true should be the sane default for services.xserver.exportConfiguration (on systemd setups).
@imuli thanks for the tip.
I got bitten by that once again when trying to use localectl list-x11-keymap-layouts and set services.xserver.exportConfiguration = true; which solved it. What about changing the defaullt ?
Note, enabling it gave a warning:
sudo nixos-rebuild -I nixos-config=/home/teto/dotfiles/nixpkgs/configuration-lenovo.nix -I nixpkgs=/home/teto/nixpkgs switch
building Nix...
building the system configuration...
these derivations will be built:
/nix/store/8yinyj4m1qv898lh7bgqzpgkislv4kpz-etc-unnamed-10.3.drv
/nix/store/cghhm24kp87qydfm08wj6y7nqakhzbc2-etc.drv
/nix/store/waqh5nn31ym6k74ci4wx97vfdbsnawkl-nixos-system-jedha-18.09.git.baa158d.drv
building '/nix/store/8yinyj4m1qv898lh7bgqzpgkislv4kpz-etc-unnamed-10.3.drv'...
building '/nix/store/cghhm24kp87qydfm08wj6y7nqakhzbc2-etc.drv'...
building '/nix/store/waqh5nn31ym6k74ci4wx97vfdbsnawkl-nixos-system-jedha-18.09.git.baa158d.drv'...
activating the configuration...
setting up /etc...
reloading user units for teto...
Linux jedha 4.14.24 #1-NixOS SMP Thu Jan 1 00:00:01 UTC 1970 x86_64 GNU/Linux
13:28:45 actif 1聽jour 2:40, 0聽utilisateur, charge moyenne聽: 0,56, 0,58, 1,02
^a pour editer la commande courante
Failed to connect to bus: No such file or directory
setting up tmpfiles
I disagree that an installed-by-default utility (localectl) should be broken unless a non-default option value is specified in configuration.nix.
I think the problem in this case is localectl. The option (services.xserver.exportConfiguration) is fine. If we're patching it anyway, shouldn't it be patched be to look in the nix store?
Or at least patched to say, "Please enable services.xserver.exportConfiguration" rather than the default, useless, "Failed to open keyboard mapping list. No such file or directory"
edit I don't think we should actually change this message, fyi.
I just ran into this same problem in NixOS 20.09 and this issue with the workaround was very hard to find. Please reconsider your stance on that.
Most helpful comment
So
trueshould be the sane default forservices.xserver.exportConfiguration(on systemd setups).