summary refs log tree commit diff
path: root/gnu/installer
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-03-25 23:21:08 +0100
committerLudovic Courtès <ludo@gnu.org>2019-03-25 23:37:05 +0100
commit3191b5f6ba5ebbb59a7448facd999ad7f7aeae79 (patch)
tree73d7737ffb85a643a5c4d70a8d26d3e95ae3d3ee /gnu/installer
parentcde08a5120b40e781bd07de6886f262dd02384d0 (diff)
downloadguix-3191b5f6ba5ebbb59a7448facd999ad7f7aeae79.tar.gz
installer: Set the system's 'keyboard-layout' field.
* gnu/installer/newt/keymap.scm (keyboard-layout->configuration): New
procedure.
* gnu/installer.scm (compute-keymap-step): Return RESULT.
(installer-steps) <'keymap>: Add 'configuration-formatter' field.
(installer-program): Use (gnu installer newt keymap).
* gnu/installer/parted.scm (bootloader-configuration): Set
'keyboard-layout'.
Diffstat (limited to 'gnu/installer')
-rw-r--r--gnu/installer/newt/keymap.scm13
-rw-r--r--gnu/installer/parted.scm6
2 files changed, 17 insertions, 2 deletions
diff --git a/gnu/installer/newt/keymap.scm b/gnu/installer/newt/keymap.scm
index 3e765bfdd4..948b54783c 100644
--- a/gnu/installer/newt/keymap.scm
+++ b/gnu/installer/newt/keymap.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,7 +28,9 @@
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
-  #:export (run-keymap-page))
+  #:use-module (ice-9 match)
+  #:export (run-keymap-page
+            keyboard-layout->configuration))
 
 (define (run-layout-page layouts layout->text)
   (let ((title (G_ "Layout")))
@@ -120,3 +123,11 @@ names of the selected keyboard layout and variant."
       (list layout (or variant ""))))
   (format-result
    (run-installer-steps #:steps keymap-steps)))
+
+(define (keyboard-layout->configuration keymap)
+  "Return the operating system configuration snippet to install KEYMAP."
+  (match keymap
+    ((name "")
+     `((keyboard-layout (keyboard-layout ,name))))
+    ((name variant)
+     `((keyboard-layout (keyboard-layout ,name ,variant))))))
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index 642b8c6d8a..24d048c04c 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -1258,7 +1258,11 @@ from (gnu system mapped-devices) and return it."
              `((bootloader grub-efi-bootloader)
                (target ,(default-esp-mount-point)))
              `((bootloader grub-bootloader)
-               (target ,root-partition-disk)))))))
+               (target ,root-partition-disk)))
+
+       ;; XXX: Assume we defined the 'keyboard-layout' field of
+       ;; <operating-system> right above.
+       (keyboard-layout keyboard-layout)))))
 
 (define (user-partitions->configuration user-partitions)
   "Return the configuration field for USER-PARTITIONS."