help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specif


From: Oleg Pykhalov
Subject: Re: Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specifying custom config path & wiping the cache
Date: Thu, 07 Jun 2018 16:03:03 +0300

Hello Alex,

"Alex Dorof" <address@hidden> writes:

[…]

> In the past I had no problem just having a script that I ran upon the
> first setup of an OS that modified system files in /usr/share/X11/xkb
> by adding my variant to symbols/us and a variant entry to
> rules/evdev.xml. It was simple and just worked. Now, enter GuixSD.

I believe files inside ‘/usr/share/X11/xcb’ are not supposed to be
modified in any distribution.  Nothing stops you from doing this, of
course.

You could do this in Guix Store ‘/gnu/store/…-xkeyboard-config’, too.
It will work until ‘guix system reconfigure’ broke it after ‘guix pull’
someday.  :-)

This should be the same with any distribution upgrade.  Distributions
provide ‘/usr/local’ for user changes to survive *distro upgrade*.

> On guix I'm forced to think more about the long term scalability of my
> system so I can't change things nilly-willy like in the past. In lieu
> of creating a proper package, I found out that I can give setxkbmap a
> custom directory (~/.config/xkb) as long as it mirrors the system one
> provided by the `xkeyboard-config` package and add my changes
> there.

I don't see ‘~/.config/xkb’ directory (in my case expanded
‘/home/natsu/.config/xkb’) mentioned in the ‘strace’ output.
--8<---------------cut here---------------start------------->8---
strace -f -o /tmp/setxkbmap.strace setxkbmap -option keypad:pointerkeys
--8<---------------cut here---------------end--------------->8---

The only file mentioned in ‘/home/natsu’ directory is
‘/home/natsu/.Xauthority’.


Grep inside of Guix Git repository returns:
--8<---------------cut here---------------start------------->8---
./gnu/services/xorg.scm:277:                 "-xkbdir" (string-append 
#$xkeyboard-config "/share/X11/xkb")
…
--8<---------------cut here---------------end--------------->8---

where ‘#$xkeyboard-config’ is a Gexp, which expands to
‘/gnu/store/…-xkeyboard-config’.

Thats why we have a ‘X’ process with ‘-xkbdir’ command line flag:
--8<---------------cut here---------------start------------->8---
  root           389  0.5  0.2  00:17 03:55 
/gnu/store/2qirp3qk8gn8k7dgy93rgssqfrszymfd-xorg-server-1.19.6/bin/X -xkbdir 
/gnu/store/fpgz8f64dnz7szskjybrwkz4l9yl1kgl-xkeyboard-config-2.23.1/share/X11/xkb
 -config /gnu/store/6vwrchilrdhp2c8ilj200yqff87zfg1a-xserver.conf -configdir 
/gnu/store/a97n3rwprlg3rr81b5pncwc909xwxb62-xorg.conf.d -logverbose -verbose 
-nolisten tcp -terminate :0 vt7 -auth /var/run/slim.auth
--8<---------------cut here---------------end--------------->8---

We could tweak ‘xorg-wrapper’ procedure to allow users to specify a
custom ‘xkeyboard-config’ package (aka Gexp).  But it will require to
modify inherited ‘xkeyboard-config’ package like in Guix blog article
‘gnome-keyring-sans-ssh-agent’ [1].

[…]

> This problem naturally makes me think that there is a precompiled
> cache involved and I need to update it. This answer
> (…)
> instructs that running the command `sudo rm /var/lib/xkb/*.xkm` will
> wipe xkb's cache. Well, guix is peculiar in many aspects but it does
> have a /var... but /var/lib/xkb is nowhere to be found! I have talked
> to the people on address@hidden and just manually searched around the
> system to no success.

Yes, no files named with ‘xkm’ in the end:
--8<---------------cut here---------------start------------->8---
find /gnu/store/ | grep 'xkm$' &> /tmp/xkm.txt
--8<---------------cut here---------------end--------------->8---

This means the problem is not with xkb's cache.  :-)

> Since most of the system outside of /var and
> /home is supposed to be static-ish, there isn't even much for me to
> look for.

Plus “outside of ‘/etc’”.

> I don't know what to do anymore. I really need this to work, badly. I
> could try to spend hours to port my config to xmodmap, but I would not
> like to do that at least at the moment.
>
> I'm helpless and at the mercy of the devs, if anyone has any info
> about xkb and setxkbmap as seen on GuixSD I would love to get in
> contact.

You could modify ‘xkeyboard-config’ and raise a version little bit.
E.g. if your ‘xkeyboard-config’ current version is ‘2.23.1’, then you
inherit package and make a ‘2.23.1-2’ or ‘2.23.2’ version.
‘./pre-inst-env guix’ will use it instead of ‘2.23.1’.  This way you
will not need to mess with ‘xorg-wrapper’ from ‘(gnu services xorg)’.
But after you will need to rebuild a lot of packages.


Also, by reading ‘xkeyboard-config-2.23.1/docs/README.config’ file from
a source of ‘xkeyboard-config’, which you could get by invoking ‘tar xf
$(guix build -S xkeyboard-config)’, I see mentioning of ‘/etc/X11/xkb’.

I don't see ‘etc’ directory in ‘find $(guix build xkeyboard-config)’,
but ‘rgrep’ in xkeyboard-config source directory shows ‘sysconfdir’:
--8<---------------cut here---------------start------------->8---
…
./configure:823:sysconfdir='${prefix}/etc'
--8<---------------cut here---------------end--------------->8---

We probably could add this flag to ‘xkeyboard-config’ package recipe:
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 9b74881e1..600bdf663 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -3839,6 +3839,9 @@ extension to the X11 protocol.  It includes:
     (native-inputs
       `(("intltool" ,intltool)
         ("pkg-config" ,pkg-config)))
+    (arguments
+     `(#:configure-flags
+       (list (string-append "--sysconfdir=/etc"))))
     (home-page "https://www.x.org/wiki/";)
     (synopsis "Xorg XKB configuration files")
     (description
This patch will allow to use ‘/etc/X11/xkb’ directory in addition to
‘/gnu/store/…-xkeyboard-config/share/X11/xkb’, I guess.

[1]  
https://www.gnu.org/software/guix/blog/2018/customize-guixsd-use-stock-ssh-agent-everywhere/

Thanks,
Oleg.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]