unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Oleg Pykhalov <go.wigust@gmail.com>
To: Alex Dorof <axd@disroot.org>
Cc: help-guix@gnu.org
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	[thread overview]
Message-ID: <87k1raoik8.fsf@gmail.com> (raw)
In-Reply-To: 8fef9b4d1f899c4570304edc57139b4c@disroot.org


[-- Attachment #1.1: Type: text/plain, Size: 5265 bytes --]

Hello Alex,

"Alex Dorof" <axd@disroot.org> 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 freenode@#guix 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:

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: gnu: xkeyboard-config: Add sysconfdir flag. --]
[-- Type: text/x-patch, Size: 509 bytes --]

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

[-- Attachment #1.3: Type: text/plain, Size: 258 bytes --]


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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

      parent reply	other threads:[~2018-06-07 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 23:36 Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specifying custom config path & wiping the cache Alex Dorof
2018-06-06  8:20 ` Pierre Neidhardt
2018-06-07 13:03 ` Oleg Pykhalov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1raoik8.fsf@gmail.com \
    --to=go.wigust@gmail.com \
    --cc=axd@disroot.org \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).