all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to add hwdb of keyboard
@ 2020-09-11 16:47 Stefan Huchler
  2020-09-11 23:51 ` Stefan Huchler
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Huchler @ 2020-09-11 16:47 UTC (permalink / raw)
  To: help-guix

I use a custom keyboard layout on one of my laptops:

https://github.com/spiderbit/emacs-ergo-thinkpad-kb-layout

I use a hwdb which has the advantage that it works on tty and x11 and
that it's keyboard specific so if I connect a external keyboard it does
not swap keys on it.

I would be ok with giving up the keyboard specific part, I could live
with X11 only for a start, but I would like to have it in the config.scm
file configured and not only in some home based modifications.

Any idea how to do that best in guix, patching a custom my-modified-dvorak
keyboard-layout into the xkeyboard-config package maybe?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-11 16:47 how to add hwdb of keyboard Stefan Huchler
@ 2020-09-11 23:51 ` Stefan Huchler
  2020-09-14 21:41   ` Stefan Huchler
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Huchler @ 2020-09-11 23:51 UTC (permalink / raw)
  To: help-guix

I build a package for it:

(define-module (x220-hwdb)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (gnu packages compression)
  #:use-module (guix build-system copy)
  #:use-module (guix licenses))

(define-public x220-hwdb
  (package
   (name "x220-hwdb")
   (version "1.0")
   (source (origin
	    (method url-fetch)
	    (uri "https://github.com/spiderbit/emacs-ergo-thinkpad-kb-layout/archive/master.zip")
	    (sha256
	     (base32
	      "0rx791b7mq5visa9ckyf7py4lz5ml51hn4mzz4rmlpnlrcds4x8v"))))
   (build-system copy-build-system)
   (inputs `(("unzip" ,unzip)))
   (synopsis "Bla")
   (description "Bla bla bla")
   (home-page "https://www.gnu.org/blablabla")
   (license gpl3+)))

and tried to link it to the expected location:

(service special-files-service-type
		  `(("/etc/udev/hwdb.d/90-X220-keyboard.hwdb"
		     ,(file-append x220-hwdb "90-X220-keyboard.hwdb"))))

the problem is that the hwdb is compiled but read only, so the file must
basically be there before the eudev package builds this db.

Is there a better way doing this?

Stefan Huchler <stefan.huchler@mail.de> writes:

> I use a custom keyboard layout on one of my laptops:
>
> https://github.com/spiderbit/emacs-ergo-thinkpad-kb-layout
>
> I use a hwdb which has the advantage that it works on tty and x11 and
> that it's keyboard specific so if I connect a external keyboard it does
> not swap keys on it.
>
> I would be ok with giving up the keyboard specific part, I could live
> with X11 only for a start, but I would like to have it in the config.scm
> file configured and not only in some home based modifications.
>
> Any idea how to do that best in guix, patching a custom my-modified-dvorak
> keyboard-layout into the xkeyboard-config package maybe?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-11 23:51 ` Stefan Huchler
@ 2020-09-14 21:41   ` Stefan Huchler
  2020-09-14 23:46     ` Ricardo Wurmus
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Huchler @ 2020-09-14 21:41 UTC (permalink / raw)
  To: help-guix

I forked now the eudev definition to add my hwdb data:

(add-before 'build-hwdb 'add-my-hwdb-file
		     (lambda* (#:key outputs #:allow-other-keys)
		       (let ((out (assoc-ref outputs "out")))
			 (call-with-output-file
			     (string-append out "/etc/udev/hwdb.d/90-X220-keyboard.hwdb")
			   (lambda (port)
			     (display
			      "keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPadX220*\n" port)
			     (display "KEYBOARD_KEY_7b=compose\n" port)
			     (display "KEYBOARD_KEY_39=enter\n" port)
			     (display "KEYBOARD_KEY_79=space\n" port)
			     (display "KEYBOARD_KEY_70=tab\n" port)
			     (display "KEYBOARD_KEY_0f=backspace\n" port)
			     (display "KEYBOARD_KEY_3a=home\n" port)
			     (display "KEYBOARD_KEY_1c=end\n" port)
			     (display "KEYBOARD_KEY_0e=backspace\n" port)
			     (display "KEYBOARD_KEY_7d=backspace\n"
		     port))))))

Is there a way to make guix system priotise my modified eudev over the
upstream one?


Stefan Huchler <stefan.huchler@mail.de> writes:

> I build a package for it:
>
> (define-module (x220-hwdb)
>   #:use-module (guix packages)
>   #:use-module (guix download)
>   #:use-module (gnu packages compression)
>   #:use-module (guix build-system copy)
>   #:use-module (guix licenses))
>
> (define-public x220-hwdb
>   (package
>    (name "x220-hwdb")
>    (version "1.0")
>    (source (origin
> 	    (method url-fetch)
> 	    (uri "https://github.com/spiderbit/emacs-ergo-thinkpad-kb-layout/archive/master.zip")
> 	    (sha256
> 	     (base32
> 	      "0rx791b7mq5visa9ckyf7py4lz5ml51hn4mzz4rmlpnlrcds4x8v"))))
>    (build-system copy-build-system)
>    (inputs `(("unzip" ,unzip)))
>    (synopsis "Bla")
>    (description "Bla bla bla")
>    (home-page "https://www.gnu.org/blablabla")
>    (license gpl3+)))
>
> and tried to link it to the expected location:
>
> (service special-files-service-type
> 		  `(("/etc/udev/hwdb.d/90-X220-keyboard.hwdb"
> 		     ,(file-append x220-hwdb "90-X220-keyboard.hwdb"))))
>
> the problem is that the hwdb is compiled but read only, so the file must
> basically be there before the eudev package builds this db.
>
> Is there a better way doing this?
>
> Stefan Huchler <stefan.huchler@mail.de> writes:
>
>> I use a custom keyboard layout on one of my laptops:
>>
>> https://github.com/spiderbit/emacs-ergo-thinkpad-kb-layout
>>
>> I use a hwdb which has the advantage that it works on tty and x11 and
>> that it's keyboard specific so if I connect a external keyboard it does
>> not swap keys on it.
>>
>> I would be ok with giving up the keyboard specific part, I could live
>> with X11 only for a start, but I would like to have it in the config.scm
>> file configured and not only in some home based modifications.
>>
>> Any idea how to do that best in guix, patching a custom my-modified-dvorak
>> keyboard-layout into the xkeyboard-config package maybe?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-14 21:41   ` Stefan Huchler
@ 2020-09-14 23:46     ` Ricardo Wurmus
  2020-09-15  1:44       ` Stefan Huchler
  2020-09-19 21:34       ` Stefan Huchler
  0 siblings, 2 replies; 10+ messages in thread
From: Ricardo Wurmus @ 2020-09-14 23:46 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: help-guix


Hi Stefan,

it took me a while to reply to your original message, because I didn’t
know what hwdb was supposed to mean.  The code snippet in this mail made
it clearer to me.

> I forked now the eudev definition to add my hwdb data:
>
> (add-before 'build-hwdb 'add-my-hwdb-file
> 		     (lambda* (#:key outputs #:allow-other-keys)
> 		       (let ((out (assoc-ref outputs "out")))
> 			 (call-with-output-file
> 			     (string-append out "/etc/udev/hwdb.d/90-X220-keyboard.hwdb")
> 			   (lambda (port)
> 			     (display
> 			      "keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPadX220*\n" port)
> 			     (display "KEYBOARD_KEY_7b=compose\n" port)
> 			     (display "KEYBOARD_KEY_39=enter\n" port)
> 			     (display "KEYBOARD_KEY_79=space\n" port)
> 			     (display "KEYBOARD_KEY_70=tab\n" port)
> 			     (display "KEYBOARD_KEY_0f=backspace\n" port)
> 			     (display "KEYBOARD_KEY_3a=home\n" port)
> 			     (display "KEYBOARD_KEY_1c=end\n" port)
> 			     (display "KEYBOARD_KEY_0e=backspace\n" port)
> 			     (display "KEYBOARD_KEY_7d=backspace\n"
> 		     port))))))
>
> Is there a way to make guix system priotise my modified eudev over the
> upstream one?

No, you would need to rebuild with your eudev as a replacement.  But
let’s take a step back: is it possible to provide this hwdb with the
udev-service?  If not, perhaps we should augment the udev-service to not
only accept udev rules, but also custom hwdb files.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-14 23:46     ` Ricardo Wurmus
@ 2020-09-15  1:44       ` Stefan Huchler
  2020-09-19 21:34       ` Stefan Huchler
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Huchler @ 2020-09-15  1:44 UTC (permalink / raw)
  To: help-guix

Hello Ricardo,

doesn't guix system not use eudev, in base.scm I see under
udev-configuration under package udev-configuration-udev (default eudev)

I think that file is very specific and if you have custom rule files why
not custom hwdb files. The problem is that this more a flavor, I use a
japanese keyboard layout and use the many thumbkeys in a "ergonomic"
way. So space as enter and the enter button as end, that is not what
everybody would want with such hardware.

So again in short, yes I think if you can add custom rule files I think
you should also be able to add custom hwdb files.


Ricardo Wurmus <rekado@elephly.net> writes:

> Hi Stefan,
>
> it took me a while to reply to your original message, because I didn’t
> know what hwdb was supposed to mean.  The code snippet in this mail made
> it clearer to me.
>
>> I forked now the eudev definition to add my hwdb data:
>>
>> (add-before 'build-hwdb 'add-my-hwdb-file
>> 		     (lambda* (#:key outputs #:allow-other-keys)
>> 		       (let ((out (assoc-ref outputs "out")))
>> 			 (call-with-output-file
>> 			     (string-append out "/etc/udev/hwdb.d/90-X220-keyboard.hwdb")
>> 			   (lambda (port)
>> 			     (display
>> 			      "keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPadX220*\n" port)
>> 			     (display "KEYBOARD_KEY_7b=compose\n" port)
>> 			     (display "KEYBOARD_KEY_39=enter\n" port)
>> 			     (display "KEYBOARD_KEY_79=space\n" port)
>> 			     (display "KEYBOARD_KEY_70=tab\n" port)
>> 			     (display "KEYBOARD_KEY_0f=backspace\n" port)
>> 			     (display "KEYBOARD_KEY_3a=home\n" port)
>> 			     (display "KEYBOARD_KEY_1c=end\n" port)
>> 			     (display "KEYBOARD_KEY_0e=backspace\n" port)
>> 			     (display "KEYBOARD_KEY_7d=backspace\n"
>> 		     port))))))
>>
>> Is there a way to make guix system priotise my modified eudev over the
>> upstream one?
>
> No, you would need to rebuild with your eudev as a replacement.  But
> let’s take a step back: is it possible to provide this hwdb with the
> udev-service?  If not, perhaps we should augment the udev-service to not
> only accept udev rules, but also custom hwdb files.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-14 23:46     ` Ricardo Wurmus
  2020-09-15  1:44       ` Stefan Huchler
@ 2020-09-19 21:34       ` Stefan Huchler
  2020-09-20  6:51         ` Ricardo Wurmus
  2020-09-20  6:52         ` Ricardo Wurmus
  1 sibling, 2 replies; 10+ messages in thread
From: Stefan Huchler @ 2020-09-19 21:34 UTC (permalink / raw)
  To: help-guix


>> I forked now the eudev definition to add my hwdb data:
>>
>> (add-before 'build-hwdb 'add-my-hwdb-file
>> 		     (lambda* (#:key outputs #:allow-other-keys)
>> 		       (let ((out (assoc-ref outputs "out")))
>> 			 (call-with-output-file
>> 			     (string-append out "/etc/udev/hwdb.d/90-X220-keyboard.hwdb")
>> 			   (lambda (port)
>> 			     (display
>> 			      "keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPadX220*\n" port)
>> 			     (display "KEYBOARD_KEY_7b=compose\n" port)
>> 			     (display "KEYBOARD_KEY_39=enter\n" port)
>> 			     (display "KEYBOARD_KEY_79=space\n" port)
>> 			     (display "KEYBOARD_KEY_70=tab\n" port)
>> 			     (display "KEYBOARD_KEY_0f=backspace\n" port)
>> 			     (display "KEYBOARD_KEY_3a=home\n" port)
>> 			     (display "KEYBOARD_KEY_1c=end\n" port)
>> 			     (display "KEYBOARD_KEY_0e=backspace\n" port)
>> 			     (display "KEYBOARD_KEY_7d=backspace\n"
>> 		     port))))))
>>
>> Is there a way to make guix system priotise my modified eudev over the
>> upstream one?
>
> No, you would need to rebuild with your eudev as a replacement.  


When I try to do that:

(define udev-service-type
  (service-type (name 'udev)
                (extensions
                 (list (service-extension shepherd-root-service-type
                                          udev-shepherd-service)))
                (compose concatenate)       ;concatenate the list of rules
                (extend (lambda (config rules)
                          (match config
                            (($ <udev-configuration> udev initial-rules)
                             (udev-configuration
                              (udev my-eudev)   ;the udev package to use
                              (rules initial-rules))))))))

I get the message:
hint: Did you forget `(use-modules (gnu services base))'?

Even I have the use-module of that in there:
(use-modules (nongnu packages linux)
             (nongnu system linux-initrd)
	     (gnu services base)
	     (gnu system linux-initrd)
	     (gnu services shepherd)
	     (eudev)
	     (gnu))

Another annoying thing is that I have to use the -I parameter from guix:
guix system reconfigure /etc/config.scm -L guix-packages/

I set that to .bashrc:

export GUIX_PACKAGE_PATH="~/guix-packages"

Why do I have to use the -L parameter when I already have defined that
path?

Any ideas?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-19 21:34       ` Stefan Huchler
@ 2020-09-20  6:51         ` Ricardo Wurmus
  2020-09-20 10:28           ` Stefan Huchler
  2020-09-20  6:52         ` Ricardo Wurmus
  1 sibling, 1 reply; 10+ messages in thread
From: Ricardo Wurmus @ 2020-09-20  6:51 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: help-guix


Stefan Huchler <stefan.huchler@mail.de> writes:

> Another annoying thing is that I have to use the -I parameter from guix:
> guix system reconfigure /etc/config.scm -L guix-packages/
>
> I set that to .bashrc:
>
> export GUIX_PACKAGE_PATH="~/guix-packages"
>
> Why do I have to use the -L parameter when I already have defined that
> path?

You should not have to.  I assume ~/guix-packages is a set of custom
modules.  GUIX_PACKAGE_PATH affects all of Guix.  But it won’t be
available when you use “sudo” unless you tell “sudo” to keep the
currently set environment (e.g. with “sudo -E”).

“guix system reconfigure” must run with root permissions.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-19 21:34       ` Stefan Huchler
  2020-09-20  6:51         ` Ricardo Wurmus
@ 2020-09-20  6:52         ` Ricardo Wurmus
  2020-09-20 10:33           ` Stefan Huchler
  1 sibling, 1 reply; 10+ messages in thread
From: Ricardo Wurmus @ 2020-09-20  6:52 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: help-guix


Stefan Huchler <stefan.huchler@mail.de> writes:

>>> I forked now the eudev definition to add my hwdb data:
>>>
>>> (add-before 'build-hwdb 'add-my-hwdb-file
>>> 		     (lambda* (#:key outputs #:allow-other-keys)
>>> 		       (let ((out (assoc-ref outputs "out")))
>>> 			 (call-with-output-file
>>> 			     (string-append out "/etc/udev/hwdb.d/90-X220-keyboard.hwdb")
>>> 			   (lambda (port)
>>> 			     (display
>>> 			      "keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPadX220*\n" port)
>>> 			     (display "KEYBOARD_KEY_7b=compose\n" port)
>>> 			     (display "KEYBOARD_KEY_39=enter\n" port)
>>> 			     (display "KEYBOARD_KEY_79=space\n" port)
>>> 			     (display "KEYBOARD_KEY_70=tab\n" port)
>>> 			     (display "KEYBOARD_KEY_0f=backspace\n" port)
>>> 			     (display "KEYBOARD_KEY_3a=home\n" port)
>>> 			     (display "KEYBOARD_KEY_1c=end\n" port)
>>> 			     (display "KEYBOARD_KEY_0e=backspace\n" port)
>>> 			     (display "KEYBOARD_KEY_7d=backspace\n"
>>> 		     port))))))
>>>
>>> Is there a way to make guix system priotise my modified eudev over the
>>> upstream one?
>>
>> No, you would need to rebuild with your eudev as a replacement.  
>
>
> When I try to do that:
>
> (define udev-service-type
>   (service-type (name 'udev)
>                 (extensions
>                  (list (service-extension shepherd-root-service-type
>                                           udev-shepherd-service)))
>                 (compose concatenate)       ;concatenate the list of rules
>                 (extend (lambda (config rules)
>                           (match config
>                             (($ <udev-configuration> udev initial-rules)
>                              (udev-configuration
>                               (udev my-eudev)   ;the udev package to use
>                               (rules initial-rules))))))))

Why not use modify-services?  All you want to do is change the
configuration of an existing service, no?

-- 
Ricardo


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-20  6:51         ` Ricardo Wurmus
@ 2020-09-20 10:28           ` Stefan Huchler
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Huchler @ 2020-09-20 10:28 UTC (permalink / raw)
  To: help-guix

I don't use sudo I loged in as root and the path is set the bashrc is loaded.

Ricardo Wurmus <rekado@elephly.net> writes:

> Stefan Huchler <stefan.huchler@mail.de> writes:
>
>> Another annoying thing is that I have to use the -I parameter from guix:
>> guix system reconfigure /etc/config.scm -L guix-packages/
>>
>> I set that to .bashrc:
>>
>> export GUIX_PACKAGE_PATH="~/guix-packages"
>>
>> Why do I have to use the -L parameter when I already have defined that
>> path?
>
> You should not have to.  I assume ~/guix-packages is a set of custom
> modules.  GUIX_PACKAGE_PATH affects all of Guix.  But it won’t be
> available when you use “sudo” unless you tell “sudo” to keep the
> currently set environment (e.g. with “sudo -E”).
>
> “guix system reconfigure” must run with root permissions.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to add hwdb of keyboard
  2020-09-20  6:52         ` Ricardo Wurmus
@ 2020-09-20 10:33           ` Stefan Huchler
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Huchler @ 2020-09-20 10:33 UTC (permalink / raw)
  To: help-guix

Because I am a Guix Noob, that's my first attempt to modify some guix
stuff and also while I am good with elisp I am not experienced with
Guile, but yes mostly it's about me beeing a guix noob, also that would
enable me to have a notebook with a good guix environment, have not even
really good access to the emacs guix tools which makes development even
more difficult.

That seemed the best quick / dirty way, that I have to update my eudev
package each update upstream and that that sucks I know and such
solution would then the next step, but if you can give me the code for
it I would be very happy :)

Ricardo Wurmus <rekado@elephly.net> writes:

> Stefan Huchler <stefan.huchler@mail.de> writes:
>
>>>> I forked now the eudev definition to add my hwdb data:
>>>>
>>>> (add-before 'build-hwdb 'add-my-hwdb-file
>>>> 		     (lambda* (#:key outputs #:allow-other-keys)
>>>> 		       (let ((out (assoc-ref outputs "out")))
>>>> 			 (call-with-output-file
>>>> 			     (string-append out "/etc/udev/hwdb.d/90-X220-keyboard.hwdb")
>>>> 			   (lambda (port)
>>>> 			     (display
>>>> 			      "keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPadX220*\n" port)
>>>> 			     (display "KEYBOARD_KEY_7b=compose\n" port)
>>>> 			     (display "KEYBOARD_KEY_39=enter\n" port)
>>>> 			     (display "KEYBOARD_KEY_79=space\n" port)
>>>> 			     (display "KEYBOARD_KEY_70=tab\n" port)
>>>> 			     (display "KEYBOARD_KEY_0f=backspace\n" port)
>>>> 			     (display "KEYBOARD_KEY_3a=home\n" port)
>>>> 			     (display "KEYBOARD_KEY_1c=end\n" port)
>>>> 			     (display "KEYBOARD_KEY_0e=backspace\n" port)
>>>> 			     (display "KEYBOARD_KEY_7d=backspace\n"
>>>> 		     port))))))
>>>>
>>>> Is there a way to make guix system priotise my modified eudev over the
>>>> upstream one?
>>>
>>> No, you would need to rebuild with your eudev as a replacement.  
>>
>>
>> When I try to do that:
>>
>> (define udev-service-type
>>   (service-type (name 'udev)
>>                 (extensions
>>                  (list (service-extension shepherd-root-service-type
>>                                           udev-shepherd-service)))
>>                 (compose concatenate)       ;concatenate the list of rules
>>                 (extend (lambda (config rules)
>>                           (match config
>>                             (($ <udev-configuration> udev initial-rules)
>>                              (udev-configuration
>>                               (udev my-eudev)   ;the udev package to use
>>                               (rules initial-rules))))))))
>
> Why not use modify-services?  All you want to do is change the
> configuration of an existing service, no?



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-20 10:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-11 16:47 how to add hwdb of keyboard Stefan Huchler
2020-09-11 23:51 ` Stefan Huchler
2020-09-14 21:41   ` Stefan Huchler
2020-09-14 23:46     ` Ricardo Wurmus
2020-09-15  1:44       ` Stefan Huchler
2020-09-19 21:34       ` Stefan Huchler
2020-09-20  6:51         ` Ricardo Wurmus
2020-09-20 10:28           ` Stefan Huchler
2020-09-20  6:52         ` Ricardo Wurmus
2020-09-20 10:33           ` Stefan Huchler

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.