unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
       [not found]   ` <8737em3ov0.fsf@elephly.net>
@ 2017-04-27 21:53     ` ng0
  2017-04-28  8:02       ` Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: ng0 @ 2017-04-27 21:53 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 25741

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

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).
-- 
PGP and more: https://people.pragmatique.xyz/ng0/

[-- Attachment #2: 0001-gnu-kbd-Add-neo-layout.patch --]
[-- Type: text/plain, Size: 3040 bytes --]

From 0377688c2db24ca87979f362433434bafd737040 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@libertad.pw>
Date: Sun, 1 Jan 2017 16:36:27 +0000
Subject: [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(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 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


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

* bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
  2017-04-27 21:53     ` ng0
@ 2017-04-28  8:02       ` Ricardo Wurmus
  2017-04-28  9:39         ` ng0
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2017-04-28  8:02 UTC (permalink / raw)
  To: ng0; +Cc: 25741


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

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

* bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
  2017-04-28  8:02       ` Ricardo Wurmus
@ 2017-04-28  9:39         ` ng0
  2017-04-28 14:37           ` Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: ng0 @ 2017-04-28  9:39 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 25741

Ricardo Wurmus transcribed 0.5K bytes:
> 
> 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 new
package which inherits from kbd, and people have to explicitly
add it to (packages) in (operating-system), it will colide with
(kbd). I think this really is the safest solution unless you
can convince me that it will work the way you proposed.

Or am I wrong and all you suggest is that (kbd) simply
finds the neo.map in the store?

I feel like kbd doesn#t work this way, but depending on
your explanation I can try.
-- 
PGP and more: https://people.pragmatique.xyz/ng0/

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

* bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
  2017-04-28  9:39         ` ng0
@ 2017-04-28 14:37           ` Ricardo Wurmus
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2017-04-28 14:37 UTC (permalink / raw)
  To: ng0; +Cc: 25741


ng0 <contact.ng0@cryptolab.net> writes:

> 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 software
have a mechanism to override or augment the search path for keymaps.

Often this is done with environment variables.  So I took the sources
and 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.


> 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 control
over the package graph.  It is easy to replace all instances of one
package with another package (see “package-input-rewriting”).  In this
case 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 where
kbd looks for keymaps.

> I feel like kbd doesn#t work this way

What makes you say this?  I don’t see anything special about kbd, but
maybe I’m missing something here.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

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

* bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
       [not found] <20170215164614.lmyymqkagvudqeq6@wasp>
@ 2017-05-25 16:47 ` ng0
  2017-05-25 18:17   ` Marius Bakke
  0 siblings, 1 reply; 6+ messages in thread
From: ng0 @ 2017-05-25 16:47 UTC (permalink / raw)
  To: 25741

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

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?

[-- Attachment #2: 0001-gnu-kbd-Add-native-search-paths.patch --]
[-- Type: application/octet-stream, Size: 1490 bytes --]

From 0818ac92ef440013f5f1013a0fcfcf2ebd7004e2 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@no-reply.pragmatique.xyz>
Date: Thu, 25 May 2017 12:48:16 +0000
Subject: [PATCH 1/2] gnu: kbd: Add 'native-search-paths'.

* gnu/packages/linux.scm (kbd)[native-search-paths]: Add it.
---
 gnu/packages/linux.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 28babb4db..04066d800 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -18,7 +18,7 @@
 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2016 Rene Saavedra <rennes@openmailbox.org>
 ;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
-;;; Copyright © 2016 ng0 <ng0@libertad.pw>
+;;; Copyright © 2016, 2017 ng0 <ng0@no-reply.pragmatique.xyz>
 ;;; 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>
@@ -1689,6 +1689,10 @@ system.")
               ("gzip" ,gzip)
               ("bzip2" ,bzip2)
               ("pam" ,linux-pam)))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "LOADKEYS_KEYMAP_PATH")
+            (files (list "share/keymaps")))))
     (native-inputs `(("pkg-config" ,pkg-config)))
     (home-page "http://kbd-project.org/")
     (synopsis "Linux keyboard utilities and keyboard maps")
-- 
2.13.0


[-- Attachment #3: 0002-gnu-Add-kbd-neo.patch --]
[-- Type: application/octet-stream, Size: 2147 bytes --]

From 41a539acfbfe7ebb30c07d585d9f1d874a3ebfe9 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@libertad.pw>
Date: Sun, 1 Jan 2017 16:36:27 +0000
Subject: [PATCH 2/2] gnu: Add kbd-neo.

* gnu/packages/linux.scm (kbd-neo): New variable.
---
 gnu/packages/linux.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 04066d800..1b6dd5411 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1641,6 +1641,37 @@ system.")
     (license (list license:gpl2                   ;programs
                    license:lgpl2.1))))            ;library
 
+(define-public kbd-neo
+  (package
+    (name "kbd-neo")
+    (version "2486")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://svn.neo-layout.org/!svn/bc/"
+                           version "/linux/console/neo.map"))
+       (file-name (string-append name "-" version ".map"))
+       (sha256
+        (base32
+         "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder (begin
+                   (use-modules (guix build utils))
+                   (let ((out (string-append %output "/share/keymaps"))
+                         (source (assoc-ref %build-inputs "source")))
+                     (mkdir-p out)
+                     (copy-file source (string-append out "/neo.map"))))))
+    (home-page "https://neo-layout.org")
+    (synopsis "Neo2 console layout for loadkeys(1)")
+    (description
+     "Kbd-neo provides the Neo2 keyboard layout for use with loadkeys(1)
+with kbd(4).")
+    ;; The file is located in an svn directory, the entire content of
+    ;; the directory is licensed as GPL3.
+    (license license:gpl3)))
+
 (define-public kbd
   (package
     (name "kbd")
@@ -1689,6 +1720,7 @@ system.")
               ("gzip" ,gzip)
               ("bzip2" ,bzip2)
               ("pam" ,linux-pam)))
+
     (native-search-paths
      (list (search-path-specification
             (variable "LOADKEYS_KEYMAP_PATH")
-- 
2.13.0


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

* bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout.
  2017-05-25 16:47 ` bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout ng0
@ 2017-05-25 18:17   ` Marius Bakke
  0 siblings, 0 replies; 6+ messages in thread
From: Marius Bakke @ 2017-05-25 18:17 UTC (permalink / raw)
  To: ng0, 25741

[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]

ng0@pragmatique.xyz writes:

> 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:

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 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+)))
--8<---------------cut here---------------end--------------->8---

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

end of thread, other threads:[~2017-05-25 18:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170215164614.lmyymqkagvudqeq6@wasp>
2017-05-25 16:47 ` bug#25741: [PATCH 2/2] gnu: kbd: Add neo layout ng0
2017-05-25 18:17   ` Marius Bakke
     [not found] <20170215164800.15907-1-contact.ng0@cryptolab.net>
     [not found] ` <20170215164800.15907-2-contact.ng0@cryptolab.net>
     [not found]   ` <8737em3ov0.fsf@elephly.net>
2017-04-27 21:53     ` ng0
2017-04-28  8:02       ` Ricardo Wurmus
2017-04-28  9:39         ` ng0
2017-04-28 14:37           ` Ricardo Wurmus

Code repositories for project(s) associated with this public inbox

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

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).