unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] services: Add console-keymap service.
@ 2015-04-25 20:24 Alex Kost
  2015-04-25 23:53 ` 宋文武
  2015-04-29 20:23 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Kost @ 2015-04-25 20:24 UTC (permalink / raw)
  To: guix-devel

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

Sometimes people on #guix ask about a way to change a console keymap,
for example: <https://gnunet.org/bot/log/guix/2015-04-25#T640696>.

So I think it would be good to add a service for loadkeys, what do
people think?

宋文武: This patch is based on your work
<http://lists.gnu.org/archive/html/guix-devel/2014-11/msg00692.html>, so
I tried to credit you in a commit message, but I'm not sure If I did it
right.  Is it OK?


[-- Attachment #2: 0001-services-Add-console-keymap-service.patch --]
[-- Type: text/x-patch, Size: 2549 bytes --]

From f879481f96386617d070b146aa2c3d1988deff40 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Sat, 25 Apr 2015 22:52:29 +0300
Subject: [PATCH] services: Add console-keymap service.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/services/base.scm (console-keymap-service): New procedure.
* doc/guix.texi (Base Services): Document it.

Co-authored-by: 宋文武 <iyzsong@gmail.com>
---
 doc/guix.texi         |  5 +++++
 gnu/services/base.scm | 15 +++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 4269d4f..c342ebc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4737,6 +4737,11 @@ passed to @command{guix-daemon}.
 Run @var{udev}, which populates the @file{/dev} directory dynamically.
 @end deffn
 
+@deffn {Monadic Procedure} console-keymap-service @var{file}
+Return a service to load console keymap from @var{file} using
+@command{loadkeys} command.
+@end deffn
+
 
 @node Networking Services
 @subsubsection Networking Services
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index d0a2e8c..49eccda 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
             swap-service
             user-processes-service
             host-name-service
+            console-keymap-service
             console-font-service
             udev-service
             mingetty-service
@@ -313,6 +315,19 @@ stopped before 'kill' is called."
           (else
            (zero? (cdr (waitpid pid))))))))
 
+(define (console-keymap-service file)
+  "Return a service to load console keymap from @var{file}."
+  (with-monad %store-monad
+    (return
+     (service
+      (documentation
+       (string-append "Load '" file "' console keymap (loadkeys)."))
+      (provision '(console-keymap))
+      (start #~(lambda _
+                 (zero? (system* (string-append #$kbd "/bin/loadkeys")
+                                 #$file))))
+      (respawn? #f)))))
+
 (define* (console-font-service tty #:optional (font "LatGrkCyr-8x16"))
   "Return a service that sets up Unicode support in @var{tty} and loads
 @var{font} for that tty (fonts are per virtual console in Linux.)"
-- 
2.2.1


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

* Re: [PATCH] services: Add console-keymap service.
  2015-04-25 20:24 [PATCH] services: Add console-keymap service Alex Kost
@ 2015-04-25 23:53 ` 宋文武
  2015-04-29 20:23 ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: 宋文武 @ 2015-04-25 23:53 UTC (permalink / raw)
  To: Alex Kost, guix-devel

Alex Kost <alezost@gmail.com> writes:

> Sometimes people on #guix ask about a way to change a console keymap,
> for example: <https://gnunet.org/bot/log/guix/2015-04-25#T640696>.
>
> So I think it would be good to add a service for loadkeys, what do
> people think?
>
> 宋文武: This patch is based on your work
> <http://lists.gnu.org/archive/html/guix-devel/2014-11/msg00692.html>, so
> I tried to credit you in a commit message, but I'm not sure If I did it
> right.  Is it OK?
Yes, thanks!
>
> From f879481f96386617d070b146aa2c3d1988deff40 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Sat, 25 Apr 2015 22:52:29 +0300
> Subject: [PATCH] services: Add console-keymap service.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> * gnu/services/base.scm (console-keymap-service): New procedure.
> * doc/guix.texi (Base Services): Document it.
>
> Co-authored-by: 宋文武 <iyzsong@gmail.com>
> ---
>  doc/guix.texi         |  5 +++++
>  gnu/services/base.scm | 15 +++++++++++++++
>  2 files changed, 20 insertions(+)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 4269d4f..c342ebc 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -4737,6 +4737,11 @@ passed to @command{guix-daemon}.
>  Run @var{udev}, which populates the @file{/dev} directory dynamically.
>  @end deffn
>  
> +@deffn {Monadic Procedure} console-keymap-service @var{file}
> +Return a service to load console keymap from @var{file} using
> +@command{loadkeys} command.
> +@end deffn
> +
>  
>  @node Networking Services
>  @subsubsection Networking Services
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index d0a2e8c..49eccda 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -1,5 +1,6 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
> +;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -46,6 +47,7 @@
>              swap-service
>              user-processes-service
>              host-name-service
> +            console-keymap-service
>              console-font-service
>              udev-service
>              mingetty-service
> @@ -313,6 +315,19 @@ stopped before 'kill' is called."
>            (else
>             (zero? (cdr (waitpid pid))))))))
>  
> +(define (console-keymap-service file)
> +  "Return a service to load console keymap from @var{file}."
> +  (with-monad %store-monad
> +    (return
> +     (service
> +      (documentation
> +       (string-append "Load '" file "' console keymap (loadkeys)."))
> +      (provision '(console-keymap))
> +      (start #~(lambda _
> +                 (zero? (system* (string-append #$kbd "/bin/loadkeys")
> +                                 #$file))))
> +      (respawn? #f)))))
> +
>  (define* (console-font-service tty #:optional (font "LatGrkCyr-8x16"))
>    "Return a service that sets up Unicode support in @var{tty} and loads
>  @var{font} for that tty (fonts are per virtual console in Linux.)"
> -- 
> 2.2.1

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

* Re: [PATCH] services: Add console-keymap service.
  2015-04-25 20:24 [PATCH] services: Add console-keymap service Alex Kost
  2015-04-25 23:53 ` 宋文武
@ 2015-04-29 20:23 ` Ludovic Courtès
  2015-04-30 16:22   ` Alex Kost
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2015-04-29 20:23 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> From f879481f96386617d070b146aa2c3d1988deff40 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Sat, 25 Apr 2015 22:52:29 +0300
> Subject: [PATCH] services: Add console-keymap service.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> * gnu/services/base.scm (console-keymap-service): New procedure.
> * doc/guix.texi (Base Services): Document it.
>
> Co-authored-by: 宋文武 <iyzsong@gmail.com>

[...]

> +      (documentation
> +       (string-append "Load '" file "' console keymap (loadkeys)."))

Please make it a literal string, thus omitting FILE entirely.

Otherwise LGTM, please push.

Eventually, this should probably be promoted as a field in
‘operating-system’, with the service automatically added as part of
‘essential-services’.  WDYT?

Thanks to both of you!

Ludo’.

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

* Re: [PATCH] services: Add console-keymap service.
  2015-04-29 20:23 ` Ludovic Courtès
@ 2015-04-30 16:22   ` Alex Kost
  2015-04-30 16:37     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Kost @ 2015-04-30 16:22 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-04-29 23:23 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
> [...]
>
>> +      (documentation
>> +       (string-append "Load '" file "' console keymap (loadkeys)."))
>
> Please make it a literal string, thus omitting FILE entirely.

OK, do you mean like this?:

  "Load console keymap (loadkeys)."

> Otherwise LGTM, please push.

Thanks.

> Eventually, this should probably be promoted as a field in
> ‘operating-system’, with the service automatically added as part of
> ‘essential-services’.  WDYT?

Probably; I don't have an opinion on that.

-- 
Alex

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

* Re: [PATCH] services: Add console-keymap service.
  2015-04-30 16:22   ` Alex Kost
@ 2015-04-30 16:37     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2015-04-30 16:37 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2015-04-29 23:23 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>> [...]
>>
>>> +      (documentation
>>> +       (string-append "Load '" file "' console keymap (loadkeys)."))
>>
>> Please make it a literal string, thus omitting FILE entirely.
>
> OK, do you mean like this?:
>
>   "Load console keymap (loadkeys)."

Yes, thanks.

Ludo’.

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

end of thread, other threads:[~2015-04-30 16:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-25 20:24 [PATCH] services: Add console-keymap service Alex Kost
2015-04-25 23:53 ` 宋文武
2015-04-29 20:23 ` Ludovic Courtès
2015-04-30 16:22   ` Alex Kost
2015-04-30 16:37     ` Ludovic Courtès

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