neo layout for kbd

DoneSubmitted by ng0.
Details
4 participants
  • ng0
  • Marius Bakke
  • ng0
  • Ricardo Wurmus
Owner
Somebody
Severity
normal
N
(address . guix-patches@gnu.org)
20170215164614.lmyymqkagvudqeq6@wasp
This adds two changes to the "kbd" package, to add the neo2 layout.
I just configured a test system with it and it works.
I'd prefer to find an smaller way to add the neo.map file, but this isfunctional for now.

-- ng0 -- https://www.inventati.org/patternsinthechaos/
C
C
contact.ng0 wrote on 15 Feb 2017 17:48
[PATCH 2/2] gnu: kbd: Add neo layout.
(address . 25741@debbugs.gnu.org)(name . ng0)(address . ng0@libertad.pw)
20170215164800.15907-2-contact.ng0@cryptolab.net
From: ng0 <ng0@libertad.pw>
* gnu/packages/linux.scm (kbd): Add neo layout.[arguments]: Add new 'install-neo-layout' and 'add-neo-directory' phases.[native-inputs]: Add 'kbd-neo'.--- gnu/packages/linux.scm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
Toggle diff (43 lines)diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scmindex 65221579b..45314eeb0 100644--- a/gnu/packages/linux.scm+++ b/gnu/packages/linux.scm@@ -1658,6 +1658,12 @@ system.") (arguments '(#:phases (modify-phases %standard-phases+ (add-before 'configure 'add-neo-directory+ (lambda _+ (substitute* "data/Makefile.am"+ (("mac/all")+ "mac/all i386/neo"))+ #t)) (add-before 'build 'pre-build (lambda* (#:key inputs #:allow-other-keys) (let ((gzip (assoc-ref %build-inputs "gzip"))@@ -1675,12 +1681,21 @@ system.") (for-each (lambda (prog) (wrap-program (string-append bin "/" prog) `("PATH" ":" prefix (,bin))))- '("unicode_start" "unicode_stop"))))))))+ '("unicode_start" "unicode_stop")))))+ (add-before 'install 'install-neo-layout+ (lambda* (#:key inputs outputs #:allow-other-keys)+ (let* ((neo (assoc-ref %build-inputs "kbd-neo"))+ (out (assoc-ref outputs "out"))+ (neomap (string-append neo "/share/keymaps/i386/neo/neo.map"))+ (keymaps (string-append out "/share/keymaps/i386/neo")))+ (mkdir-p keymaps)+ (install-file neomap keymaps))))))) (inputs `(("check" ,check) ("gzip" ,gzip) ("bzip2" ,bzip2) ("pam" ,linux-pam)))- (native-inputs `(("pkg-config" ,pkg-config)))+ (native-inputs `(("pkg-config" ,pkg-config)+ ("kbd-neo" ,kbd-neo))) (home-page "ftp://ftp.kernel.org/pub/linux/utils/kbd/") (synopsis "Linux keyboard utilities and keyboard maps") (description-- 2.11.1
C
C
contact.ng0 wrote on 15 Feb 2017 17:47
[PATCH 1/2] gnu: Add kbd-neo.
(address . 25741@debbugs.gnu.org)(name . ng0)(address . ng0@libertad.pw)
20170215164800.15907-1-contact.ng0@cryptolab.net
From: ng0 <ng0@libertad.pw>
* gnu/packages/linux.scm (kbd-neo): New variable.--- gnu/packages/linux.scm | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-)
Toggle diff (69 lines)diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scmindex d53f5487b..65221579b 100644--- a/gnu/packages/linux.scm+++ b/gnu/packages/linux.scm@@ -17,7 +17,7 @@ ;;; Copyright © 2016 John Darrington <jmd@gnu.org> ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2016 Rene Saavedra <rennes@openmailbox.org>-;;; Copyright © 2016 ng0 <ng0@libertad.pw>+;;; Copyright © 2016, 2017 ng0 <contact.ng0@cryptolab.net> ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> ;;; Copyright © 2017 José Miguel Sánchez García <jmi2k@openmailbox.com> ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>@@ -90,6 +90,7 @@ #:use-module (guix build-system python) #:use-module (guix build-system trivial) #:use-module (guix download)+ #:use-module (guix svn-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils)@@ -1592,6 +1593,45 @@ system.") (license (list license:gpl2 ;programs license:lgpl2.1)))) ;library +;; The Neo layout is a GPL3 licensed layout already present in Xorg,+;; but not in kbd. home-page: https://neo-layout.org+(define kbd-neo+ (let ((svn-revision 2476)+ (revision "1"))+ (package+ (name "kbd-neo")+ (version (string-append "0.0.0-" revision "."+ (number->string svn-revision)))+ (source+ (origin+ (method svn-fetch)+ (uri (svn-reference+ ;; The SVN branch with the neo.map file.+ (url "https://svn.neo-layout.org/linux/console")+ (revision svn-revision)))+ (file-name (string-append name "-" version "-checkout"))+ (sha256+ (base32+ "169hmlwcwz5sp605i8q5ikckxwsj1n3isylrnynflp30gbv9zrwn"))))+ (build-system trivial-build-system)+ (arguments+ `(#:modules ((guix build utils))+ #:builder (begin+ (use-modules (guix build utils))+ (let ((out (string-append %output+ "/share/keymaps/i386/neo"))+ (source (assoc-ref %build-inputs "source")))+ (mkdir-p out)+ (copy-file (string-append source "/neo.map")+ (string-append out "/neo.map"))))))+ (native-inputs+ `(("source" ,source)))+ (home-page "https://neo-layout.org")+ (license license:gpl3)+ (synopsis "Neo2 console font")+ (description+ "Neo2 console font intended to be installed with kbd."))))+ (define-public kbd (package (name "kbd")-- 2.11.1
R
R
Ricardo Wurmus wrote on 9 Mar 2017 08:07
(address . contact.ng0@cryptolab.net)
874lz32aib.fsf@elephly.net
contact.ng0@cryptolab.net writes:
Toggle quote (3 lines)> From: ng0 <ng0@libertad.pw>>> * gnu/packages/linux.scm (kbd-neo): New variable.
[…]
Toggle quote (3 lines)> +;; The Neo layout is a GPL3 licensed layout already present in Xorg,> +;; but not in kbd. home-page: https://neo-layout.org
Please remove this comment.
Toggle quote (4 lines)> +(define kbd-neo> + (let ((svn-revision 2476)> + (revision "1"))
SVN revisions are monotonically increasing, so we don’t need the“revision” hack.
Toggle quote (16 lines)> + (package> + (name "kbd-neo")> + (version (string-append "0.0.0-" revision "."> + (number->string svn-revision)))> + (source> + (origin> + (method svn-fetch)> + (uri (svn-reference> + ;; The SVN branch with the neo.map file.> + (url "https://svn.neo-layout.org/linux/console")> + (revision svn-revision)))> + (file-name (string-append name "-" version "-checkout"))> + (sha256> + (base32> + "169hmlwcwz5sp605i8q5ikckxwsj1n3isylrnynflp30gbv9zrwn"))))
Actually, you can get the neo.map file at the given revision 2476 with“url-fetch” from this URL:
https://svn.neo-layout.org/!svn/bc/2476/linux/console/neo.map
This would be better than to use the more complicated “svn-fetch”.

Toggle quote (12 lines)> + (build-system trivial-build-system)> + (arguments> + `(#:modules ((guix build utils))> + #:builder (begin> + (use-modules (guix build utils))> + (let ((out (string-append %output> + "/share/keymaps/i386/neo"))> + (source (assoc-ref %build-inputs "source")))> + (mkdir-p out)> + (copy-file (string-append source "/neo.map")> + (string-append out "/neo.map"))))))
If you’re using the plain URL above this would be simplified a little.
Toggle quote (3 lines)> + (native-inputs> + `(("source" ,source)))
I don’t think this is needed
Toggle quote (3 lines)> + (home-page "https://neo-layout.org")> + (license license:gpl3)
Please move the license field below “description” for consistency. Itis unfortunate that there are no license headers and that the license inthe COPYING file is explicitly declared to apply to all files in therepository.
Toggle quote (2 lines)> + (synopsis "Neo2 console font")
This is not a font as far as I can see.
Toggle quote (4 lines)> + (description> + "Neo2 console font intended to be installed with kbd."))))> +
Please use full sentences in the description.
--Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAChttps://elephly.net
R
R
Ricardo Wurmus wrote on 9 Mar 2017 08:12
Re: bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
(address . contact.ng0@cryptolab.net)
8737em3ov0.fsf@elephly.net
contact.ng0@cryptolab.net writes:
Toggle quote (7 lines)> From: ng0 <ng0@libertad.pw>>> * gnu/packages/linux.scm (kbd): Add neo layout.> [arguments]: Add new 'install-neo-layout' and 'add-neo-directory' phases.> [native-inputs]: Add 'kbd-neo'.> ---
I must say that this looks like a hack. Shouldn’t it be sufficient toinstall the gzipped map file to some directory? Why is it necessary tolet kdb take care of installing the keymap?
If it is just a matter of finding the desired keymap at runtime, I thinkit would be better to use a search path (if it exists).
-- Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAChttps://elephly.net
R
R
Ricardo Wurmus wrote on 9 Mar 2017 08:14
control message for bug #25741
(address . control@debbugs.gnu.org)
E1clsHw-0000W0-4q@debbugs.gnu.org
owner 25741 !
N
Re: bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
(name . Ricardo Wurmus)(address . rekado@elephly.net)
20170309120150.wwt2kwfktshlp6gy@abyayala
Ricardo Wurmus transcribed 0.6K bytes:
Toggle quote (24 lines)> > contact.ng0@cryptolab.net writes:> > > From: ng0 <ng0@libertad.pw>> >> > * gnu/packages/linux.scm (kbd): Add neo layout.> > [arguments]: Add new 'install-neo-layout' and 'add-neo-directory' phases.> > [native-inputs]: Add 'kbd-neo'.> > ---> > I must say that this looks like a hack. Shouldn’t it be sufficient to> install the gzipped map file to some directory? Why is it necessary to> let kdb take care of installing the keymap?> > If it is just a matter of finding the desired keymap at runtime, I think> it would be better to use a search path (if it exists).> > -- > Ricardo> > GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC> https://elephly.net>
I've looked at Nix, and I've looked at the Makefile of kbd. This is theway which works. I'm not sure if adding a searchpath would have the sameeffect, but once I have fixed the neo patch I can try it. Even if it'sjust to point out that it doesn't work this way.
Thanks for your reviews, I'll send updated patches as soon as I havefixed my systems.
R
R
Ricardo Wurmus wrote on 14 Mar 2017 20:00
control message for bug #25741
(address . control@debbugs.gnu.org)
E1cnrgb-0002ED-Ps@debbugs.gnu.org
tags 25741 moreinfo
N
Re: bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
(name . Ricardo Wurmus)(address . rekado@elephly.net)
20170427215337.smsuh3jkuq7gw2ua@abyayala
Alright, here is the reworked version.
Because it is equal to the result of the previous one, I ampositive that it works like this (the previous version did).-- PGP and more: https://people.pragmatique.xyz/ng0/
From 0377688c2db24ca87979f362433434bafd737040 Mon Sep 17 00:00:00 2001From: ng0 <ng0@libertad.pw>Date: Sun, 1 Jan 2017 16:36:27 +0000Subject: [PATCH] gnu: kbd: Add neo layout.
* gnu/packages/linux.scm (kbd): Add neo layout.[arguments]: Add new 'install-neo-layout' and 'add-neo-directory' phases.[native-inputs]: Add 'kbd-neo'.--- gnu/packages/linux.scm | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
Toggle diff (55 lines)diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scmindex 0b299f9e5..b2a552718 100644--- a/gnu/packages/linux.scm+++ b/gnu/packages/linux.scm@@ -1674,6 +1674,12 @@ system.") (arguments '(#:phases (modify-phases %standard-phases+ (add-before 'configure 'add-neo-directory+ (lambda _+ (substitute* "data/Makefile.am"+ (("mac/all")+ "mac/all i386/neo"))+ #t)) (add-before 'build 'pre-build (lambda* (#:key inputs #:allow-other-keys) (let ((gzip (assoc-ref %build-inputs "gzip"))@@ -1691,12 +1697,33 @@ system.") (for-each (lambda (prog) (wrap-program (string-append bin "/" prog) `("PATH" ":" prefix (,bin))))- '("unicode_start" "unicode_stop"))))))))+ '("unicode_start" "unicode_stop")))))+ (add-before 'install 'install-neo-layout+ (lambda* (#:key inputs outputs #:allow-other-keys)+ (let* ((neo (assoc-ref %build-inputs "kbd-neo"))+ (out (assoc-ref outputs "out"))+ (neo-keymaps (string-append out "/share/keymaps/i386/neo")))+ (mkdir-p neo-keymaps)+ (install-file neo neo-keymaps)+ ;; Rename the file as it includes a hash in the filename.+ (for-each (lambda (file)+ (rename-file file (string-append neo-keymaps "/neo.map")))+ (find-files (string-append out "/share/keymaps")+ "neo\\.map$"))+ #t)))))) (inputs `(("check" ,check) ("gzip" ,gzip) ("bzip2" ,bzip2) ("pam" ,linux-pam)))- (native-inputs `(("pkg-config" ,pkg-config)))+ (native-inputs `(("pkg-config" ,pkg-config)+ ("kbd-neo"+ ,(origin+ (method url-fetch)+ (uri (string-append "https://svn.neo-layout.org/!svn/bc/"+ "2476/linux/console/neo.map"))+ (sha256+ (base32+ "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g")))))) (home-page "ftp://ftp.kernel.org/pub/linux/utils/kbd/") (synopsis "Linux keyboard utilities and keyboard maps") (description-- 2.12.2
R
R
Ricardo Wurmus wrote on 28 Apr 2017 10:02
(name . ng0)(address . contact.ng0@cryptolab.net)(address . 25741@debbugs.gnu.org)
87d1bxarj4.fsf@elephly.net
ng0 <contact.ng0@cryptolab.net> writes:
Toggle quote (5 lines)> Alright, here is the reworked version.>> Because it is equal to the result of the previous one, I am> positive that it works like this (the previous version did).
Thanks. This still modifies the kbd package. Have you tried what Iproposed, namely to install this as a separate package and /somehow/make kbd find the installed keymap? It would be nicer than to modifythe kbd package itself.
-- Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net
N
(name . Ricardo Wurmus)(address . rekado@elephly.net)
20170428093940.qebl5oexqszdblw3@abyayala
Ricardo Wurmus transcribed 0.5K bytes:
Toggle quote (20 lines)> > ng0 <contact.ng0@cryptolab.net> writes:> > > Alright, here is the reworked version.> >> > Because it is equal to the result of the previous one, I am> > positive that it works like this (the previous version did).> > Thanks. This still modifies the kbd package. Have you tried what I> proposed, namely to install this as a separate package and /somehow/> make kbd find the installed keymap? It would be nicer than to modify> the kbd package itself.> > -- > Ricardo> > GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC> https://elephly.net>
Would this still work as intended?kbd is a global package, part of the base. If I create a newpackage which inherits from kbd, and people have to explicitlyadd it to (packages) in (operating-system), it will colide with(kbd). I think this really is the safest solution unless youcan convince me that it will work the way you proposed.
Or am I wrong and all you suggest is that (kbd) simplyfinds the neo.map in the store?
I feel like kbd doesn#t work this way, but depending onyour explanation I can try.-- PGP and more: https://people.pragmatique.xyz/ng0/
R
R
Ricardo Wurmus wrote on 28 Apr 2017 16:37
(name . ng0)(address . contact.ng0@cryptolab.net)(address . 25741@debbugs.gnu.org)
87bmrgy4vz.fsf@elephly.net
ng0 <contact.ng0@cryptolab.net> writes:
Toggle quote (3 lines)> Would this still work as intended?> kbd is a global package, part of the base.
This doesn’t matter. The question here is: does this piece of softwarehave a mechanism to override or augment the search path for keymaps.
Often this is done with environment variables. So I took the sourcesand searched for “getenv”:
tar xf $(guix build kbd) grep getenv -r kbd-*
Here’s what turned up:
[…]kbd-2.0.4/src/libkeymap/analyze.l: if ((ev = getenv("LOADKEYS_INCLUDE_PATH")) != NULL) {kbd-2.0.4/src/libkeymap/analyze.c: if ((ev = getenv("LOADKEYS_INCLUDE_PATH")) != NULL) {kbd-2.0.4/src/loadkeys.c: if ((ev = getenv("LOADKEYS_KEYMAP_PATH")) != NULL) {[…]
This might be useful.

Toggle quote (5 lines)> If I create a new> package which inherits from kbd, and people have to explicitly> add it to (packages) in (operating-system), it will colide with> (kbd).
I don’t understand what you mean. Guix gives us programmatic controlover the package graph. It is easy to replace all instances of onepackage with another package (see “package-input-rewriting”). In thiscase that’s not even necessary; one can just take the “%base-packages”list, delete “kbd” from it, and cons “my-custom-kbd” onto it.
However, none of this will be needed if you can augment the path wherekbd looks for keymaps.
Toggle quote (2 lines)> I feel like kbd doesn#t work this way
What makes you say this? I don’t see anything special about kbd, butmaybe I’m missing something here.
--Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAChttps://elephly.net
N
bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
(name . 25741)(address . 25741@debbugs.gnu.org)
E1dDvvU-0005MJ-Rm@rmmprod05.runbox
I updated with the changes you suggested and reconfigured my system with the patches applied.
Executing on tty1 as privileged user, "loadkeys neo" works and does what it should do.
Is it good to go now?
M
M
Marius Bakke wrote on 25 May 2017 20:17
87tw48vm11.fsf@fastmail.com
ng0@pragmatique.xyz writes:
Toggle quote (6 lines)> I updated with the changes you suggested and reconfigured my system with the patches applied.>> Executing on tty1 as privileged user, "loadkeys neo" works and does what it should do.>> Is it good to go now?
LGTM. I pushed this with a few minor changes:
Toggle snippet (24 lines)diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scmindex ed1c6846b..2e984dd42 100644--- a/gnu/packages/linux.scm+++ b/gnu/packages/linux.scm@@ -1662,15 +1662,16 @@ system.") (let ((out (string-append %output "/share/keymaps")) (source (assoc-ref %build-inputs "source"))) (mkdir-p out)- (copy-file source (string-append out "/neo.map"))))))+ (copy-file source (string-append out "/neo.map"))+ #t)))) (home-page "https://neo-layout.org")- (synopsis "Neo2 console layout for loadkeys(1)")+ (synopsis "Neo2 console layout") (description- "Kbd-neo provides the Neo2 keyboard layout for use with loadkeys(1)-with kbd(4).")+ "Kbd-neo provides the Neo2 keyboard layout for use with+@command{loadkeys(1)} from @code{kbd(4)}.") ;; The file is located in an svn directory, the entire content of ;; the directory is licensed as GPL3.- (license license:gpl3)))+ (license license:gpl3+)))
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlknH7oACgkQoqBt8qM6VPp4Zwf+NjvuGhtcFlgMCS6dXOqQ8ymWejdDJo4sWsrbpr6clV8nYRXX8gTMN0dM+No2W7Ivkcmk4bbHopXJVZWyptxmt8v+79mMJB8DhntkVhPDUo9KOWG+m8iW7oIT+wwZf/0CAfU7k5wwsdivKibzZ4PSg6ZXZVimUWV9J1JLXeZtp6nT1oif03XyxoThOMXIXx3ByvMUW3cJnJqA5bYyCY051PiviU+cCyj4IuOeorgGj206NHKpFS7dWQrzZekijO/M7n5sFbBksmLsI6LWzmgPPum+JOtkKU6uT+FZ/cgXb6trBp7QE1NrYKMfVoF+66VCEEDjCQaP7/zBK183QiMNNA===6eT8-----END PGP SIGNATURE-----
Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 25741@debbugs.gnu.org