I might be doing something basic wrong, but this is rapidly costing me my 
sanity so I have to ask. Also, it might be a bug, but I'm not sure, so I'm 
sending it to the help list. The TLDR can be given by some simple steps to 
reproduce:

1. Clone the xkeyboard-config repository and copy, say, the German symbols file:

git clone https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config
cp xkeyboard-config/symbols/de xkeyboard-config/symbols/dem

Then edit xkeyboard-config/rules/base.xml and 
xkeyboard-config/rules/base.extras.xml, duplicate all German symbols entries 
and replace

<name>de</name>

with

<name>dem</name>

in the duplicates.

2. Create a module to locally replace xkeyboard-config with the local version 
in the dependencies of setxkbmap. Something like

(define-module (dxkb)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (gnu packages xorg))

(define-public xkeyboard-config-dem
(package
(inherit xkeyboard-config)
(name "xkeyboard-config-dem")
(source (local-file "/path/to/xkeyboard-config"
#:recursive? #t))))

(define-public rewrite-dem
(package-input-rewriting/spec `(("xkeyboard-config" . ,(const 
xkeyboard-config-dem)))))

(define-public xkbcomp-dem
(rewrite-dem xkbcomp))

3. Spawn a shell with the setxkbmap-variant:

guix shell --pure -L /path/to/test/channel -e '(@@ (test) setxkbmap-dem)'

4. Run

setxkbmap -v 10 dem basic

And you should get

Setting verbose level to 10
locale is C
Warning! Multiple definitions of keyboard layout
Using command line, ignoring X server
Warning! Multiple definitions of layout variant
Using command line, ignoring X server
Trying to load rules file ./rules/evdev...
Trying to load rules file 
/gnu/store/kzbjc31mw2mhjga44aki109kayph2w2q-xkeyboard-config-dem-2.44/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: dem
variant: basic
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+dem(basic)+inet(evdev)
geometry: pc(pc105)
Error loading new keyboard description

Optional 7. Compare to another non-Guix-system where you simply copy 
/usr/share/X11/xkb/symbols/de to /usr/share/X11/xkb/symbols/dem, run

setxkbmap dem basic

and it sets the keymap.

Optional 8. Rewrite xkbcomp similarly

(define-public xkbcomp-dxkb
(rewrite-dxkb xkbcomp))

spawn a shell and try

setxkbmap -print dem basic | xkbcomp - $DISPLAY

it should set the keymap to German.

What I'm actually trying to do is add my own symbols file from the Daselt 
project I wrote:

https://gitlab.com/nameiwillforget/daselt

I'd even like to provide a full Daselt package in the future. But to be sure 
that the error I was getting was not due to my layout file being mismatched 
with the setxkbmap version used by Guix I tried this with the procedure with a 
copy of the German layout file, which is of course error-free. I also tried 
variants of this setup, including copying the full package definitions of 
xkeyboard-config and setxkbmap and replacing the source in them. So I'm out of 
ideas. It seems the error is unique to setxkbmap, since xkbcomp can set the 
keymap, it seems not due to the rules, since I patched in the right rules 
definitions and it seems to be unique to Guix since setxkbmap doesn't do that 
on other systems. So I'd conclude that it has to be due to the changes Guix 
introduces to the compilation, but the only change to the build process is the 
--set-X-root-directory flag, which is also in the build process of xkbcomp.
Does anyone have any idea of what is going on?

Sent with [Proton Mail](https://proton.me/mail/home) secure email.

Reply via email to