From patchwork Wed Mar 20 23:04:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1508 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5B58816DB6; Wed, 20 Mar 2019 23:05:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 076EC16DB5 for ; Wed, 20 Mar 2019 23:05:11 +0000 (GMT) Received: from localhost ([127.0.0.1]:56171 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGk-0007RZ-L1 for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:05:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGe-0007NR-Gp for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kGd-0002dx-PD for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38896) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kGd-0002cn-FT for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kGd-0005ed-8f for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 02/12] bootloader: Reindent record type definition. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:05:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312309521648 (code B ref 34929); Wed, 20 Mar 2019 23:05:03 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:04:55 +0000 Received: from localhost ([127.0.0.1]:52425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGU-0005d5-Ea for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:04:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56802) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGT-0005cS-0c for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:04:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGN-0002Lw-Lm; Wed, 20 Mar 2019 19:04:47 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGL-0004wC-Mr; Wed, 20 Mar 2019 19:04:46 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:25 +0100 Message-Id: <20190320230435.25458-2-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/bootloader.scm (): Reindent. --- gnu/bootloader.scm | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 5ae8ea3ee3..e48bcc073c 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -104,25 +104,25 @@ (define-record-type* bootloader-configuration make-bootloader-configuration bootloader-configuration? - (bootloader bootloader-configuration-bootloader) ; - (target bootloader-configuration-target ; string - (default #f)) - (menu-entries bootloader-configuration-menu-entries ; list of - (default '())) - (default-entry bootloader-configuration-default-entry ; integer - (default 0)) - (timeout bootloader-configuration-timeout ; seconds as integer - (default 5)) - (theme bootloader-configuration-theme ; bootloader-specific theme - (default #f)) - (terminal-outputs bootloader-configuration-terminal-outputs ; list of symbols - (default '(gfxterm))) - (terminal-inputs bootloader-configuration-terminal-inputs ; list of symbols - (default '())) - (serial-unit bootloader-configuration-serial-unit ; integer | #f - (default #f)) - (serial-speed bootloader-configuration-serial-speed ; integer | #f - (default #f))) + (bootloader bootloader-configuration-bootloader) ; + (target bootloader-configuration-target ;string + (default #f)) + (menu-entries bootloader-configuration-menu-entries ;list of + (default '())) + (default-entry bootloader-configuration-default-entry ;integer + (default 0)) + (timeout bootloader-configuration-timeout ;seconds as integer + (default 5)) + (theme bootloader-configuration-theme ;bootloader-specific theme + (default #f)) + (terminal-outputs bootloader-configuration-terminal-outputs ;list of symbols + (default '(gfxterm))) + (terminal-inputs bootloader-configuration-terminal-inputs ;list of symbols + (default '())) + (serial-unit bootloader-configuration-serial-unit ;integer | #f + (default #f)) + (serial-speed bootloader-configuration-serial-speed ;integer | #f + (default #f))) ;;; From patchwork Wed Mar 20 23:04:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1507 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 12A7D16DB7; Wed, 20 Mar 2019 23:05:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 1C66616DB4 for ; Wed, 20 Mar 2019 23:05:09 +0000 (GMT) Received: from localhost ([127.0.0.1]:56161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGi-0007Pc-OO for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:05:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGf-0007OB-W9 for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kGe-0002fW-Q6 for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38898) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kGe-0002fD-Ij for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kGe-0005el-AD for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 03/12] Add (gnu system keyboard). Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:05:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312309921676 (code B ref 34929); Wed, 20 Mar 2019 23:05:04 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:04:59 +0000 Received: from localhost ([127.0.0.1]:52430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGX-0005dV-UG for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:04:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGT-0005cU-RY for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:04:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGO-0002MT-Ld; Wed, 20 Mar 2019 19:04:48 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGN-0004wC-VV; Wed, 20 Mar 2019 19:04:48 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:26 +0100 Message-Id: <20190320230435.25458-3-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/system/keyboard.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu.scm (%public-modules): Add it. --- gnu.scm | 3 +- gnu/local.mk | 1 + gnu/system/keyboard.scm | 98 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 gnu/system/keyboard.scm diff --git a/gnu.scm b/gnu.scm index 3e7e7c0ebc..2c29b6dc3f 100644 --- a/gnu.scm +++ b/gnu.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ludovic Courtès ;;; Copyright © 2015 Joshua S. Grant ;;; Copyright © 2017 Mathieu Othacehe ;;; @@ -45,6 +45,7 @@ (gnu system file-systems) (gnu bootloader) (gnu bootloader grub) + (gnu system keyboard) (gnu system pam) (gnu system shadow) ; 'user-account' (gnu system linux-initrd) diff --git a/gnu/local.mk b/gnu/local.mk index af2bf87273..b1ad9c9d8b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -536,6 +536,7 @@ GNU_SYSTEM_MODULES = \ %D%/system/accounts.scm \ %D%/system/file-systems.scm \ %D%/system/install.scm \ + %D%/system/keyboard.scm \ %D%/system/linux-container.scm \ %D%/system/linux-initrd.scm \ %D%/system/locale.scm \ diff --git a/gnu/system/keyboard.scm b/gnu/system/keyboard.scm new file mode 100644 index 0000000000..cd3ab37b27 --- /dev/null +++ b/gnu/system/keyboard.scm @@ -0,0 +1,98 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu system keyboard) + #:use-module (guix gexp) + #:use-module ((gnu packages xorg) + #:select (xkeyboard-config console-setup)) + #:use-module (srfi srfi-9 gnu) + #:use-module (ice-9 match) + #:export (keyboard-layout? + keyboard-layout + keyboard-layout-name + keyboard-layout-variant + keyboard-layout-model + keyboard-layout-options + + keyboard-layout->console-keymap)) + +;;; Commentary: +;;; +;;; This module provides a data structure to represent keyboard layouts +;;; according to the XKB naming and classification (see the 'xkeyboard-config' +;;; package). +;;; +;;; Code: + +(define-immutable-record-type + (%keyboard-layout name variant model options) + keyboard-layout? + (name keyboard-layout-name) ;string + (variant keyboard-layout-variant) ;#f | string + (model keyboard-layout-model) ;#f | string + (options keyboard-layout-options)) ;list of strings + +(define* (keyboard-layout name #:optional variant + #:key model (options '())) + "Return a new keyboard layout with the given NAME and VARIANT. + +NAME must be a string such as \"fr\"; VARIANT must be a string such as +\"bepo\" or \"nodeadkeys\". See the 'xkeyboard-config' package for valid +options." + (%keyboard-layout name variant model options)) + +(define* (keyboard-layout->console-keymap layout + #:key + (xkeyboard-config xkeyboard-config)) + "Return a Linux console keymap file for LAYOUT, a record. +Layout information is taken from the XKEYBOARD-CONFIG package." + (define build + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils) + (ice-9 popen) + (ice-9 match)) + + (define pipe + (open-pipe* OPEN_READ + #+(file-append console-setup "/bin/ckbcomp") + (string-append "-I" + #+(file-append xkeyboard-config + "/share/X11/xkb")) + "-rules" "base" + #$@(match (keyboard-layout-model layout) + (#f '()) + (model `("-model" ,model))) + #$(keyboard-layout-name layout) + #$(or (keyboard-layout-variant layout) + "") + #$(string-join (keyboard-layout-options layout) ","))) + + (call-with-output-file #$output + (lambda (output) + (dump-port pipe output))) + + ;; Note: ckbcomp errors out when the layout name is unknown, but + ;; merely emits a warning when the variant is unknown. + (unless (zero? (close-pipe pipe)) + (error "failed to create console keymap for keyboard layout" + #$(keyboard-layout-name layout)))))) + + (computed-file (string-append "console-keymap." + (keyboard-layout-name layout)) + build)) From patchwork Wed Mar 20 23:04:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1506 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BB1F616DB7; Wed, 20 Mar 2019 23:05:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 450E016DB5 for ; Wed, 20 Mar 2019 23:05:10 +0000 (GMT) Received: from localhost ([127.0.0.1]:56165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGj-0007Qf-Se for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:05:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGh-0007P0-4d for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kGf-0002gp-S3 for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38901) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kGf-0002gX-K7 for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kGf-0005f3-BO for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 04/12] bootloader: Add a 'keyboard-layout' field. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:05:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312309921689 (code B ref 34929); Wed, 20 Mar 2019 23:05:05 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:04:59 +0000 Received: from localhost ([127.0.0.1]:52432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGY-0005dX-MK for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:04:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGV-0005ca-Fq for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:04:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGP-0002Ny-MX; Wed, 20 Mar 2019 19:04:49 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGP-0004wC-5o; Wed, 20 Mar 2019 19:04:49 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:27 +0100 Message-Id: <20190320230435.25458-4-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nee Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/bootloader/grub.scm (keyboard-layout-file): New procedure. (grub-configuration-file)[keyboard-layout-file]: New variable. [builder]: Use it. * gnu/bootloader.scm ()[keyboard-layout]: New field. * doc/guix.texi (Bootloader Configuration): Document it. Co-authored-by: nee --- doc/guix.texi | 28 ++++++++++++++++++++++++++++ gnu/bootloader.scm | 3 +++ gnu/bootloader/grub.scm | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 63581bbe41..c687f78eac 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -23134,6 +23134,34 @@ current system. The number of seconds to wait for keyboard input before booting. Set to 0 to boot immediately, and to -1 to wait indefinitely. +@cindex keyboard layout, for the bootloader +@item @code{keyboard-layout} (default: @code{#f}) +If this is @code{#f}, the bootloader's menu (if any) uses the default keyboard +layout, usually US@tie{}English (``qwerty''). + +Otherwise, this must be a @code{keyboard-layout} object. For instance, the +following example defines a standard German keyboard layout: + +@example +(keyboard-layout "de") +@end example + +@noindent +while the example below designates the bépo layout for French: + +@example +(keyboard-layout "fr" "bepo") +@end example + +The layout name and variant must match an existing layout in the +@code{xkeyboard-config} package under the @file{share/X11/xkb/symbols} +directory. + +@quotation Note +This option is currently ignored by bootloaders other than @code{grub} and +@code{grub-efi}. +@end quotation + @item @code{theme} (default: @var{#f}) The bootloader theme object describing the theme to use. If no theme is provided, some bootloaders might use a default theme, that's true diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index e48bcc073c..e7f7331dd8 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -47,6 +47,7 @@ bootloader-configuration-menu-entries bootloader-configuration-default-entry bootloader-configuration-timeout + bootloader-configuration-keyboard-layout bootloader-configuration-theme bootloader-configuration-terminal-outputs bootloader-configuration-terminal-inputs @@ -113,6 +114,8 @@ (default 0)) (timeout bootloader-configuration-timeout ;seconds as integer (default 5)) + (keyboard-layout bootloader-configuration-keyboard-layout ;string | #f + (default #f)) (theme bootloader-configuration-theme ;bootloader-specific theme (default #f)) (terminal-outputs bootloader-configuration-terminal-outputs ;list of symbols diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 14aede72c5..e97a17b3e2 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -27,8 +27,10 @@ #:use-module (gnu bootloader) #:use-module (gnu system uuid) #:use-module (gnu system file-systems) + #:use-module (gnu system keyboard) #:autoload (gnu packages bootloaders) (grub) #:autoload (gnu packages gtk) (guile-cairo guile-rsvg) + #:autoload (gnu packages xorg) (xkeyboard-config) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) @@ -219,6 +221,26 @@ fi~%" ;;; Configuration file. ;;; +(define* (keyboard-layout-file layout + #:key + (grub grub)) + "Process the X keyboard layout description LAYOUT, a record, +and return a file in the format for GRUB keymaps. LAYOUT must be present in +the 'share/X11/xkb/symbols/' directory of 'xkeyboard-config'." + (define builder + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + ;; 'grub-kbdcomp' passes all its arguments but '-o' to 'ckbcomp' + ;; (from the 'console-setup' package). + (invoke #$(file-append grub "/bin/grub-mklayout") + "-i" #+(keyboard-layout->console-keymap layout) + "-o" #$output)))) + + (computed-file (string-append "grub-keymap." (keyboard-layout-name layout)) + builder)) + (define (grub-setup-io config) "Return GRUB commands to configure the input / output interfaces. The result is a string that can be inserted in grub.cfg." @@ -330,6 +352,18 @@ entries corresponding to old generations of the system." #:system system #:port #~port)) + (define keyboard-layout-config + (let ((layout (bootloader-configuration-keyboard-layout config)) + (grub (bootloader-package + (bootloader-configuration-bootloader config)))) + #~(let ((keymap #$(and layout + (keyboard-layout-file layout #:grub grub)))) + (when keymap + (format port "\ +terminal_input at_keyboard +insmod keylayouts +keymap ~a~%" keymap))))) + (define builder #~(call-with-output-file #$output (lambda (port) @@ -338,6 +372,7 @@ entries corresponding to old generations of the system." # will be lost upon reconfiguration. ") #$sugar + #$keyboard-layout-config (format port " set default=~a set timeout=~a~%" From patchwork Wed Mar 20 23:04:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1509 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0052116DB6; Wed, 20 Mar 2019 23:05:20 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 9EB8A16DB4 for ; Wed, 20 Mar 2019 23:05:20 +0000 (GMT) Received: from localhost ([127.0.0.1]:56184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGu-0007fK-6w for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:05:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGh-0007PV-UE for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kGg-0002iY-UJ for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38902) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kGg-0002i5-KF for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kGg-0005fE-BV for guix-patches@gnu.org; Wed, 20 Mar 2019 19:05:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 05/12] services: xorg: Remove unused #:guile parameter. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:05:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312310021701 (code B ref 34929); Wed, 20 Mar 2019 23:05:06 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:05:00 +0000 Received: from localhost ([127.0.0.1]:52435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGZ-0005dm-LQ for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGV-0005ch-Ux for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:04:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGQ-0002Ou-M8; Wed, 20 Mar 2019 19:04:50 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGQ-0004wC-3J; Wed, 20 Mar 2019 19:04:50 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:28 +0100 Message-Id: <20190320230435.25458-5-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/xorg.scm (xorg-wrapper): Remove #:guile, which was unused. (xorg-start-command): Likewise. (xinitrc): Likewise. --- doc/guix.texi | 2 +- gnu/services/xorg.scm | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index c687f78eac..622740b11c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13310,7 +13310,7 @@ type @code{}. @end example @end deffn -@deffn {Scheme Procedure} xorg-start-command [#:guile] @ +@deffn {Scheme Procedure} xorg-start-command @ [#:modules %default-xorg-modules] @ [#:fonts %default-xorg-fonts] @ [#:configuration-file (xorg-configuration-file @dots{})] @ diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index f2a3c28c90..8381a7ed04 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -261,7 +261,6 @@ in @var{modules}." #t)))) (define* (xorg-wrapper #:key - (guile (canonical-package guile-2.0)) (modules %default-xorg-modules) (configuration-file (xorg-configuration-file #:modules modules)) @@ -287,7 +286,6 @@ in place of @code{/usr/bin/X}." (program-file "X-wrapper" exp)) (define* (xorg-start-command #:key - (guile (canonical-package guile-2.0)) (modules %default-xorg-modules) (fonts %default-xorg-fonts) (configuration-file @@ -300,8 +298,7 @@ packages, and @var{fonts}, a list of X font directories, are available. See @code{xorg-wrapper} for more details on the arguments. The result should be used in place of @code{startx}." (define X - (xorg-wrapper #:guile guile - #:configuration-file configuration-file + (xorg-wrapper #:configuration-file configuration-file #:modules modules #:xorg-server xorg-server)) (define exp @@ -312,9 +309,7 @@ used in place of @code{startx}." (program-file "startx" exp)) -(define* (xinitrc #:key - (guile (canonical-package guile-2.0)) - fallback-session) +(define* (xinitrc #:key fallback-session) "Return a system-wide xinitrc script that starts the specified X session, which should be passed to this script as the first argument. If not, the @var{fallback-session} will be used or, if @var{fallback-session} is false, a From patchwork Wed Mar 20 23:04:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1514 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 595E016DBE; Wed, 20 Mar 2019 23:06:28 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 85D5616DB5 for ; Wed, 20 Mar 2019 23:06:27 +0000 (GMT) Received: from localhost ([127.0.0.1]:56194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHz-00081W-2n for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:06:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHd-0007rl-VO for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kHc-0003Oh-1S for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38915) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kHb-0003OY-QS for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kHb-0005hk-Jh for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 06/12] services: xorg: Define and record type. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:06:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312310621788 (code B ref 34929); Wed, 20 Mar 2019 23:06:03 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:05:06 +0000 Received: from localhost ([127.0.0.1]:52445 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGf-0005f4-Ar for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56819) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGX-0005cr-Mz for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:04:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGS-0002Ps-AK; Wed, 20 Mar 2019 19:04:52 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGR-0004wC-0O; Wed, 20 Mar 2019 19:04:51 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:29 +0100 Message-Id: <20190320230435.25458-6-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/xorg.scm (): New record type. (xorg-configuration-file): Remove. (xorg-wrapper): Remove #:modules, #:configuration-file, and #:xorg-server; add optional 'config' parameter instead. Adjust accordingly. (xorg-start-command): Likewise. * doc/guix.texi (X Window): Document 'xorg-configuration'. Update 'xorg-start-command' documentation. Remove 'xorg-configuration-file' documentation. --- doc/guix.texi | 134 ++++++++++++++---------------------------- gnu/services/xorg.scm | 115 ++++++++++++++++++------------------ 2 files changed, 101 insertions(+), 148 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 622740b11c..2363874cf9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13310,99 +13310,53 @@ type @code{}. @end example @end deffn -@deffn {Scheme Procedure} xorg-start-command @ - [#:modules %default-xorg-modules] @ - [#:fonts %default-xorg-fonts] @ - [#:configuration-file (xorg-configuration-file @dots{})] @ - [#:xorg-server @var{xorg-server}] - [#:xserver-arguments '("-nolisten" "tcp")] -Return a @code{startx} script in which @var{modules}, a list of X module -packages, and @var{fonts}, a list of X font directories, are available. See -@code{xorg-wrapper} for more details on the arguments. The result should be -used in place of @code{startx}. - -Usually the X server is started by a login manager. -@end deffn - -@cindex @code{-listen tcp}, for X11. -This procedure is useful to override command line options for the X server, -such as having it listen to over TCP: - -@example -(operating-system - ... - (services - (modify-services %desktop-services - (slim-service-type config => - (slim-configuration - (inherit config) - (startx (xorg-start-command - #:xserver-arguments '("-listen" "tcp")))))))) -@end example - -@deffn {Scheme Procedure} xorg-configuration-file @ - [#:modules %default-xorg-modules] @ - [#:fonts %default-xorg-fonts] @ - [#:drivers '()] [#:resolutions '()] [#:extra-config '()] -Return a configuration file for the Xorg server containing search paths for -all the common drivers. - -@var{modules} must be a list of @dfn{module packages} loaded by the Xorg +@cindex Xorg, configuration +@deftp {Data Type} xorg-configuration +This data type represents the configuration of the Xorg graphical display +server. Note that there is not Xorg service; instead, the X server is started +by a ``display manager'' such as GDM, SDDM, and SLiM. Thus, the configuration +of these display managers aggregates an @code{xorg-configuration} record. + +@table @asis +@item @code{modules} (default: @code{%default-xorg-modules}) +This is a list of @dfn{module packages} loaded by the Xorg server---e.g., @code{xf86-video-vesa}, @code{xf86-input-keyboard}, and so on. -@var{fonts} must be a list of font directories to add to the server's -@dfn{font path}. - -@var{drivers} must be either the empty list, in which case Xorg chooses a -graphics driver automatically, or a list of driver names that will be tried in -this order---e.g., @code{("modesetting" "vesa")}. - -Likewise, when @var{resolutions} is the empty list, Xorg chooses an -appropriate screen resolution; otherwise, it must be a list of -resolutions---e.g., @code{((1024 768) (640 480))}. - -Last, @var{extra-config} is a list of strings or objects appended to the -configuration file. It is used to pass extra text to be -added verbatim to the configuration file. - -@cindex keymap -@cindex keyboard layout -This procedure is especially useful to configure a different keyboard layout -than the default US keymap. For instance, to use the ``bépo'' keymap by -default on the display manager: - -@example -(define bepo-evdev - "Section \"InputClass\" - Identifier \"evdev keyboard catchall\" - Driver \"evdev\" - MatchIsKeyboard \"on\" - Option \"xkb_layout\" \"fr\" - Option \"xkb_variant\" \"bepo\" -EndSection") - -(operating-system - ... - (services - (modify-services %desktop-services - (slim-service-type config => - (slim-configuration - (inherit config) - (startx (xorg-start-command - #:configuration-file - (xorg-configuration-file - #:extra-config - (list bepo-evdev))))))))) -@end example - -The @code{MatchIsKeyboard} line specifies that we only apply the configuration -to keyboards. Without this line, other devices such as touchpad may not work -correctly because they will be attached to the wrong driver. In this example, -the user typically used @code{setxkbmap fr bepo} to set their favorite keymap -once logged in. The first argument corresponds to the layout, while the second -argument corresponds to the variant. The @code{xkb_variant} line can be omitted -to select the default variant. + +@item @code{fonts} (default: @code{%default-xorg-fonts}) +This is a list of font directories to add to the server's @dfn{font path}. + +@item @code{drivers} (default: @code{'()}) +This must be either the empty list, in which case Xorg chooses a graphics +driver automatically, or a list of driver names that will be tried in this +order---e.g., @code{("modesetting" "vesa")}. + +@item @code{resolutions} (default: @code{'()}) +When @code{resolutions} is the empty list, Xorg chooses an appropriate screen +resolution. Otherwise, it must be a list of resolutions---e.g., @code{((1024 +768) (640 480))}. + +@item @code{extra-config} (default: @code{'()}) +This is a list of strings or objects appended to the configuration file. It +is used to pass extra text to be added verbatim to the configuration file. + +@item @code{server} (default: @code{xorg-server}) +This is the package providing the Xorg server. + +@item @code{server-arguments} (default: @code{%default-xorg-server-arguments}) +This is the list of command-line arguments to pass to the X server. The +default is @code{-nolisten tcp}. +@end table +@end deftp + +@deffn {Scheme Procedure} xorg-start-command [@var{config}] +Return a @code{startx} script in which the modules, fonts, etc. specified +in @var{config}, are available. The result should be used in place of +@code{startx}. + +Usually the X server is started by a login manager. @end deffn + @deffn {Scheme Procedure} screen-locker-service @var{package} [@var{program}] Add @var{package}, a package for a screen locker or screen saver whose command is @var{program}, to the set of setuid programs and add a PAM entry diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 8381a7ed04..3c547c1303 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -48,7 +48,16 @@ #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:use-module (ice-9 match) - #:export (xorg-configuration-file + #:export (xorg-configuration + xorg-configuration? + xorg-configuration-modules + xorg-configuration-fonts + xorg-configuration-drivers + xorg-configuration-resolutions + xorg-configuration-extra-config + xorg-configuration-server + xorg-configuration-server-arguments + %default-xorg-modules %default-xorg-fonts xorg-wrapper @@ -122,33 +131,36 @@ "/share/fonts/X11/misc") (file-append font-adobe75dpi "/share/fonts/X11/75dpi"))) -(define* (xorg-configuration-file #:key - (modules %default-xorg-modules) - (fonts %default-xorg-fonts) - (drivers '()) (resolutions '()) - (extra-config '())) - "Return a configuration file for the Xorg server containing search paths for -all the common drivers. +(define %default-xorg-server-arguments + ;; Default command-line arguments for X. + '("-nolisten" "tcp")) -@var{modules} must be a list of @dfn{module packages} loaded by the Xorg -server---e.g., @code{xf86-video-vesa}, @code{xf86-input-keyboard}, and so on. -@var{fonts} must be a list of font directories to add to the server's -@dfn{font path}. +;; Configuration of an Xorg server. +(define-record-type* + xorg-configuration make-xorg-configuration + xorg-configuration? + (modules xorg-configuration-modules ;list of packages + (default %default-xorg-modules)) + (fonts xorg-configuration-fonts ;list of packges + (default %default-xorg-fonts)) + (drivers xorg-configuration-drivers ;list of strings + (default '())) + (resolutions xorg-configuration-resolutions ;list of tuples + (default '())) + (extra-config xorg-configuration-extra-config ;list of strings + (default '())) + (server xorg-configuration-server ;package + (default xorg-server)) + (server-arguments xorg-configuration-server-arguments ;list of strings + (default %default-xorg-server-arguments))) -@var{drivers} must be either the empty list, in which case Xorg chooses a -graphics driver automatically, or a list of driver names that will be tried in -this order---e.g., @code{(\"modesetting\" \"vesa\")}. - -Likewise, when @var{resolutions} is the empty list, Xorg chooses an -appropriate screen resolution; otherwise, it must be a list of -resolutions---e.g., @code{((1024 768) (640 480))}. - -Last, @var{extra-config} is a list of strings or objects appended to the -configuration file. It is used to pass extra text to be -added verbatim to the configuration file." +(define (xorg-configuration->file config) + "Compute an Xorg configuration file corresponding to CONFIG, an + record." (define all-modules ;; 'xorg-server' provides 'fbdevhw.so' etc. - (append modules (list xorg-server))) + (append (xorg-configuration-modules config) + (list xorg-server))) (define build #~(begin @@ -159,7 +171,7 @@ added verbatim to the configuration file." (call-with-output-file #$output (lambda (port) (define drivers - '#$drivers) + '#$(xorg-configuration-drivers config)) (define (device-section driver) (string-append " @@ -201,7 +213,7 @@ EndSection")) (display "Section \"Files\"\n" port) (for-each (lambda (font) (format port " FontPath \"~a\"~%" font)) - '#$fonts) + '#$(xorg-configuration-fonts config)) (for-each (lambda (module) (format port " ModulePath \"~a\"~%" @@ -221,7 +233,8 @@ EndSection\n" port) port) (newline port) (display (string-join - (map (cut screen-section <> '#$resolutions) + (map (cut screen-section <> + '#$(xorg-configuration-resolutions config)) drivers) "\n") port) @@ -229,11 +242,10 @@ EndSection\n" port) (for-each (lambda (config) (display config port)) - '#$extra-config))))) + '#$(xorg-configuration-extra-config config)))))) (computed-file "xserver.conf" build)) - (define (xorg-configuration-directory modules) "Return a directory that contains the @code{.conf} files for X.org that includes the @code{share/X11/xorg.conf.d} directories of each package listed @@ -260,51 +272,38 @@ in @var{modules}." files) #t)))) -(define* (xorg-wrapper #:key - (modules %default-xorg-modules) - (configuration-file (xorg-configuration-file - #:modules modules)) - (xorg-server xorg-server)) - "Return a derivation that builds a @var{guile} script to start the X server -from @var{xorg-server}. @var{configuration-file} is the server configuration -file or a derivation that builds it; when omitted, the result of -@code{xorg-configuration-file} is used. The resulting script should be used -in place of @code{/usr/bin/X}." +(define* (xorg-wrapper #:optional (config (xorg-configuration))) + "Return a derivation that builds a script to start the X server with the +given @var{config}. The resulting script should be used in place of +@code{/usr/bin/X}." (define exp ;; Write a small wrapper around the X server. #~(begin (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri")) (setenv "XKB_BINDIR" (string-append #$xkbcomp "/bin")) - (let ((X (string-append #$xorg-server "/bin/X"))) + (let ((X (string-append #$(xorg-configuration-server config) "/bin/X"))) (apply execl X X "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb") - "-config" #$configuration-file - "-configdir" #$(xorg-configuration-directory modules) + "-config" #$(xorg-configuration->file config) + "-configdir" #$(xorg-configuration-directory + (xorg-configuration-modules config)) (cdr (command-line)))))) (program-file "X-wrapper" exp)) -(define* (xorg-start-command #:key - (modules %default-xorg-modules) - (fonts %default-xorg-fonts) - (configuration-file - (xorg-configuration-file #:modules modules - #:fonts fonts)) - (xorg-server xorg-server) - (xserver-arguments '("-nolisten" "tcp"))) - "Return a @code{startx} script in which @var{modules}, a list of X module -packages, and @var{fonts}, a list of X font directories, are available. See -@code{xorg-wrapper} for more details on the arguments. The result should be -used in place of @code{startx}." +(define* (xorg-start-command #:optional (config (xorg-configuration))) + "Return a @code{startx} script in which the modules, fonts, etc. specified +in @var{config}, are available. The result should be used in place of +@code{startx}." (define X - (xorg-wrapper #:configuration-file configuration-file - #:modules modules - #:xorg-server xorg-server)) + (xorg-wrapper config)) + (define exp ;; Write a small wrapper around the X server. #~(apply execl #$X #$X ;; Second #$X is for argv[0]. - "-logverbose" "-verbose" "-terminate" #$@xserver-arguments + "-logverbose" "-verbose" "-terminate" + #$@(xorg-configuration-server-arguments config) (cdr (command-line)))) (program-file "startx" exp)) From patchwork Wed Mar 20 23:04:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1510 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 486E716DB7; Wed, 20 Mar 2019 23:06:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 238B516DB4 for ; Wed, 20 Mar 2019 23:06:10 +0000 (GMT) Received: from localhost ([127.0.0.1]:56188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHh-0007sD-Ln for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:06:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHe-0007rm-1Y for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kHc-0003P3-IP for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38916) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kHc-0003Op-8k for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kHc-0005hr-2l for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 07/12] services: sddm, slim, gdm: Take an record. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:06:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312310721805 (code B ref 34929); Wed, 20 Mar 2019 23:06:04 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:05:07 +0000 Received: from localhost ([127.0.0.1]:52449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGg-0005fN-NV for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGY-0005cy-SH for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:00 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGT-0002R9-GG; Wed, 20 Mar 2019 19:04:53 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGS-0004wC-NI; Wed, 20 Mar 2019 19:04:53 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:30 +0100 Message-Id: <20190320230435.25458-7-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/sddm.scm ()[xorg-server-path] [xserver-arguments]: Remove. [xorg-configuration]: New field. (sddm-configuration-file): Adjust accordingly. * gnu/services/xorg.scm ()[startx]: Remove. [xorg-configuration]: New field. (slim-shepherd-service, slim-service): Adjust accordingly. ()[x-server]: Remove. [xorg-configuration]: New field. (gdm-shepherd-service, gdm-service): Adjust accordingly. * doc/guix.texi (X Window): Update accordingly. --- doc/guix.texi | 11 ++++------- gnu/services/sddm.scm | 14 ++++++++------ gnu/services/xorg.scm | 19 +++++++++---------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 2363874cf9..6b73225697 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13181,8 +13181,8 @@ your user profile. Failing to do that, if @code{auto-login-session} is false, you will be unable to log in. @end quotation -@item @code{startx} (default: @code{(xorg-start-command)}) -The command used to start the X11 graphical server. +@item @code{xorg-configuration} (default @code{(xorg-configuration)}) +Configuration of the Xorg graphical server. @item @code{xauth} (default: @code{xauth}) The XAuth package to use. @@ -13258,8 +13258,8 @@ Script to run before starting a wayland session. @item @code{sessions-directory} (default "/run/current-system/profile/share/wayland-sessions") Directory to look for desktop files starting wayland sessions. -@item @code{xorg-server-path} (default @code{xorg-start-command}) -Path to xorg-server. +@item @code{xorg-configuration} (default @code{(xorg-configuration)}) +Configuration of the Xorg graphical server. @item @code{xauth-path} (default @code{#~(string-append #$xauth "/bin/xauth")}) Path to xauth. @@ -13282,9 +13282,6 @@ Directory to look for desktop files starting X sessions. @item @code{minimum-vt} (default: 7) Minimum VT to use. -@item @code{xserver-arguments} (default "-nolisten tcp") -Arguments to pass to xorg-server. - @item @code{auto-login-user} (default "") User to use for auto-login. diff --git a/gnu/services/sddm.scm b/gnu/services/sddm.scm index 2ebfe22016..a33eb39c43 100644 --- a/gnu/services/sddm.scm +++ b/gnu/services/sddm.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 David Craven +;;; Copyright © 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -83,8 +84,8 @@ (sessions-directory sddm-configuration-sessions-directory (default "/run/current-system/profile/share/wayland-sessions")) ;; [X11] - (xorg-server-path sddm-configuration-xorg-server-path - (default (xorg-start-command))) + (xorg-configuration sddm-configuration-xorg + (default (xorg-configuration))) (xauth-path sddm-configuration-xauth-path (default (file-append xauth "/bin/xauth"))) (xephyr-path sddm-configuration-xephyr-path @@ -99,8 +100,6 @@ (default "/run/current-system/profile/share/xsessions")) (minimum-vt sddm-configuration-minimum-vt (default 7)) - (xserver-arguments sddm-configuration-xserver-arguments - (default "-nolisten tcp")) ;; [Autologin] (auto-login-user sddm-configuration-auto-login-user @@ -140,7 +139,8 @@ SessionCommand=" (sddm-configuration-session-command config) " SessionDir=" (sddm-configuration-sessions-directory config) " [X11] -ServerPath=" (sddm-configuration-xorg-server-path config) " +ServerPath=" (xorg-configuration-server + (sddm-configuration-xorg config)) " XauthPath=" (sddm-configuration-xauth-path config) " XephyrPath=" (sddm-configuration-xephyr-path config) " DisplayCommand=" (sddm-configuration-xdisplay-start config) " @@ -148,7 +148,9 @@ DisplayStopCommand=" (sddm-configuration-xdisplay-stop config) " SessionCommand=" (sddm-configuration-xsession-command config) " SessionDir=" (sddm-configuration-xsessions-directory config) " MinimumVT=" (number->string (sddm-configuration-minimum-vt config)) " -ServerArguments=" (sddm-configuration-xserver-arguments config) " +ServerArguments=" (string-join + (xorg-configuration-server-arguments + (sddm-configuration-xorg config))) " [Autologin] User=" (sddm-configuration-auto-login-user config) " diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 3c547c1303..a3a4d769d7 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -436,8 +436,8 @@ desktop session from the system or user profile will be used." (default shepherd)) (auto-login-session slim-configuration-auto-login-session (default #f)) - (startx slim-configuration-startx - (default (xorg-start-command))) + (xorg-configuration slim-configuration-xorg + (default (xorg-configuration))) (sessreg slim-configuration-sessreg (default sessreg))) @@ -454,7 +454,7 @@ desktop session from the system or user profile will be used." (slim-configuration-auto-login-session config))) (slim (slim-configuration-slim config)) (xauth (slim-configuration-xauth config)) - (startx (slim-configuration-startx config)) + (startx (xorg-start-command (slim-configuration-xorg config))) (shepherd (slim-configuration-shepherd config)) (theme-name (slim-configuration-theme-name config)) (sessreg (slim-configuration-sessreg config))) @@ -561,8 +561,7 @@ theme." (auto-login? auto-login?) (default-user default-user) (theme theme) (theme-name theme-name) (xauth xauth) (shepherd shepherd) - (auto-login-session auto-login-session) - (startx startx)))) + (auto-login-session auto-login-session)))) ;;; @@ -641,8 +640,8 @@ makes the good ol' XlockMore usable." (default-user gdm-configuration-default-user (default #f)) (gnome-shell-assets gdm-configuration-gnome-shell-assets (default (list adwaita-icon-theme font-cantarell))) - (x-server gdm-configuration-x-server - (default (xorg-wrapper))) + (xorg-configuration gdm-configuration-xorg + (default (xorg-configuration))) (x-session gdm-configuration-x-session (default (xinitrc)))) @@ -714,7 +713,8 @@ makes the good ol' XlockMore usable." #$(gdm-configuration-dbus-daemon config)) (string-append "GDM_X_SERVER=" - #$(gdm-configuration-x-server config)) + #$(xorg-wrapper + (gdm-configuration-xorg config))) (string-append "GDM_X_SESSION=" #$(gdm-configuration-x-session config)) @@ -779,7 +779,6 @@ password." (service gdm-service-type (gdm-configuration (gdm gdm) - (allow-empty-passwords? allow-empty-passwords?) - (x-server x-server)))) + (allow-empty-passwords? allow-empty-passwords?)))) ;;; xorg.scm ends here From patchwork Wed Mar 20 23:04:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1513 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id AC68A16DB6; Wed, 20 Mar 2019 23:06:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 50C3F16DB4 for ; Wed, 20 Mar 2019 23:06:17 +0000 (GMT) Received: from localhost ([127.0.0.1]:56186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHm-0007sC-Hp for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:06:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHe-0007rn-AZ for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kHd-0003PI-0s for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38917) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kHc-0003P9-OM for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kHc-0005hz-Hk for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 08/12] services: xorg: Add a 'keyboard-layout' field in . Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:06:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312310721813 (code B ref 34929); Wed, 20 Mar 2019 23:06:04 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:05:07 +0000 Received: from localhost ([127.0.0.1]:52451 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGh-0005fe-B3 for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGZ-0005d6-TC for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:00 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGU-0002SH-L4; Wed, 20 Mar 2019 19:04:54 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGU-0004wC-0U; Wed, 20 Mar 2019 19:04:54 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:31 +0100 Message-Id: <20190320230435.25458-8-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nee Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/xorg.scm ()[keyboard-layout]: New field. (xorg-configuration->file)[input-class-section]: New procedure. Use it. * doc/guix.texi (X Window): Document 'keyboard-layout' field. Co-authored-by: nee --- doc/guix.texi | 8 ++++++++ gnu/services/xorg.scm | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 6b73225697..5fa68d5e5a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13332,6 +13332,14 @@ When @code{resolutions} is the empty list, Xorg chooses an appropriate screen resolution. Otherwise, it must be a list of resolutions---e.g., @code{((1024 768) (640 480))}. +@cindex keyboard layout, for Xorg +@item @code{keyboard-layout} (default: @code{#f}) +If this is @code{#f}, Xorg uses the default keyboard layout---usually US +English (``qwerty'') for a 105-key PC keyboard. + +Otherwise this must be a @code{keyboard-layout} object specifying the keyboard +layout in use when Xorg is running. + @item @code{extra-config} (default: @code{'()}) This is a list of strings or objects appended to the configuration file. It is used to pass extra text to be added verbatim to the configuration file. diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index a3a4d769d7..05465f3bdf 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -25,6 +25,7 @@ #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu system pam) + #:use-module (gnu system keyboard) #:use-module (gnu services dbus) #:use-module ((gnu packages base) #:select (canonical-package)) #:use-module (gnu packages guile) @@ -147,6 +148,8 @@ (default '())) (resolutions xorg-configuration-resolutions ;list of tuples (default '())) + (keyboard-layout xorg-configuration-keyboard-layout ;#f | + (default #f)) (extra-config xorg-configuration-extra-config ;list of strings (default '())) (server xorg-configuration-server ;package @@ -195,6 +198,31 @@ Section \"Screen\" EndSubSection EndSection")) + (define (input-class-section layout variant model options) + (string-append " +Section \"InputClass\" + Identifier \"evdev keyboard catchall\" + MatchIsKeyboard \"on\" + Option \"XkbLayout\" " (object->string layout) + (if variant + (string-append " Option \"XkbVariant\" \"" + variant "\"") + "") + (if model + (string-append " Option \"XkbModel\" \"" + model "\"") + "") + (match options + (() + "") + (_ + (string-append " Option \"XkbOptions\" \"" + (string-join options ",") "\""))) " + + MatchDevicePath \"/dev/input/event*\" + Driver \"evdev\" +EndSection\n")) + (define (expand modules) ;; Append to MODULES the relevant /lib/xorg/modules ;; sub-directories. @@ -240,6 +268,19 @@ EndSection\n" port) port) (newline port) + (let ((layout #$(and=> (xorg-configuration-keyboard-layout config) + keyboard-layout-name)) + (variant #$(and=> (xorg-configuration-keyboard-layout config) + keyboard-layout-variant)) + (model #$(and=> (xorg-configuration-keyboard-layout config) + keyboard-layout-model)) + (options '#$(keyboard-layout-options + (xorg-configuration-keyboard-layout config)))) + (when layout + (display (input-class-section layout variant model options) + port) + (newline port))) + (for-each (lambda (config) (display config port)) '#$(xorg-configuration-extra-config config)))))) From patchwork Wed Mar 20 23:04:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1511 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9546E16DB6; Wed, 20 Mar 2019 23:06:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 9D03416DB5 for ; Wed, 20 Mar 2019 23:06:10 +0000 (GMT) Received: from localhost ([127.0.0.1]:56190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHi-0007sX-67 for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:06:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHe-0007ro-Gm for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kHd-0003Pe-HF for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38918) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kHd-0003PT-9V for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kHd-0005i6-29 for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 09/12] vm: 'virtualized-operating-system' inherits from the user's bootloader config. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:06:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312310821821 (code B ref 34929); Wed, 20 Mar 2019 23:06:05 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:05:08 +0000 Received: from localhost ([127.0.0.1]:52453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGh-0005fm-SD for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGa-0005dE-Sc for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGV-0002TU-K8; Wed, 20 Mar 2019 19:04:55 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGV-0004wC-1o; Wed, 20 Mar 2019 19:04:55 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:32 +0100 Message-Id: <20190320230435.25458-9-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/system/vm.scm (virtualized-operating-system): Inherit from the bootloader of OS. --- gnu/system/vm.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index b671c74ab8..b529cc4631 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -787,6 +787,7 @@ environment with the store shared with the host. MAPPINGS is a list of ;; force the traditional i386/BIOS method. ;; See . (bootloader (bootloader-configuration + (inherit (operating-system-bootloader os)) (bootloader grub-bootloader) (target "/dev/vda"))) From patchwork Wed Mar 20 23:04:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1515 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 906D716DB5; Wed, 20 Mar 2019 23:06:28 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id E267116DB7 for ; Wed, 20 Mar 2019 23:06:27 +0000 (GMT) Received: from localhost ([127.0.0.1]:56200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHz-00082K-FW for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:06:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHf-0007rp-4i for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kHe-0003QG-1y for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kHd-0003Po-Op for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kHd-0005iE-IN for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 10/12] gnu: Add loadkeys-static. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:06:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312310821829 (code B ref 34929); Wed, 20 Mar 2019 23:06:05 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:05:08 +0000 Received: from localhost ([127.0.0.1]:52455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGi-0005ft-7c for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56829) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGb-0005dS-Rk for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGW-0002U6-KH; Wed, 20 Mar 2019 19:04:56 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGW-0004wC-0j; Wed, 20 Mar 2019 19:04:56 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:33 +0100 Message-Id: <20190320230435.25458-10-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/linux.scm (loadkeys-static): New variable. --- gnu/packages/linux.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index e9d8ea45c1..de1a9ba24e 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -1995,6 +1995,43 @@ for systems using the Linux kernel. This includes commands such as 'loadkeys', 'setfont', 'kbdinfo', and 'chvt'.") (license license:gpl2+))) +(define-public loadkeys-static + (package + (inherit kbd) + (name "loadkeys-static") + (arguments + (substitute-keyword-arguments (package-arguments kbd) + ((#:configure-flags flags ''()) + `(append '("LDFLAGS=-static" "--disable-shared" "--disable-nls" + "--disable-vlock" ;so we don't need libpam + "--disable-libkeymap") + ,flags)) + ((#:make-flags flags ''()) + `(cons "LDFLAGS=-all-static" ,flags)) + ((#:phases phases '%standard-phases) + `(modify-phases ,phases + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + ;; The binary keeps references to gzip, among other things, + ;; which we don't need in the initrd, so strip references. + (remove-store-references "src/loadkeys") + + (install-file "src/loadkeys" + (string-append out "/bin")) + #t))) + (delete 'post-install))) + ((#:strip-flags _ '()) + ''("--strip-all")) + ((#:allowed-references _ '()) + '()))) + + (synopsis "Statically-linked @command{loadkeys} program") + + ;; This package is meant to be used internally in the initrd so don't + ;; expose it. + (properties '((hidden? . #t))))) + (define-public inotify-tools (package (name "inotify-tools") From patchwork Wed Mar 20 23:04:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1512 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2ABF216DB7; Wed, 20 Mar 2019 23:06:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 636E616DB4 for ; Wed, 20 Mar 2019 23:06:13 +0000 (GMT) Received: from localhost ([127.0.0.1]:56192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHl-0007vR-0A for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:06:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHg-0007sB-VD for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kHe-0003RK-Hu for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kHe-0003Qc-8O for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kHe-0005iL-1Y for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 11/12] system: Initialize console keyboard layout in the initrd. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:06:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312311021840 (code B ref 34929); Wed, 20 Mar 2019 23:06:05 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:05:10 +0000 Received: from localhost ([127.0.0.1]:52457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGi-0005g2-MD for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGc-0005dU-Qg for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGX-0002Ui-IG; Wed, 20 Mar 2019 19:04:57 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGX-0004wC-12; Wed, 20 Mar 2019 19:04:57 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:34 +0100 Message-Id: <20190320230435.25458-11-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Partially fixes . * gnu/system.scm ()[keyboard-layout]: New field. (operating-system-initrd-file): Pass #:keyboard-layout to MAKE-INITRD. * gnu/system/linux-initrd.scm (raw-initrd): Add #:keyboard-layout. Pass #:keymap-file to 'boot-system'. (base-initrd): Add #:keyboard-layout. [helper-packages]: Add LOADKEYS-STATIC when KEYBOARD-LAYOUT is true. Pass #:keyboard-layout to 'raw-initrd'. * gnu/build/linux-boot.scm (boot-system): Add #:keymap-file and honor it. * doc/guix.texi (operating-system Reference): Document the 'keyboard-layout' field. (Initial RAM Disk): Update 'raw-initrd' and 'base-initrd' documentation. --- doc/guix.texi | 34 +++++++++++++++++++++++++++++++++- gnu/build/linux-boot.scm | 15 +++++++++++++-- gnu/system.scm | 7 +++++-- gnu/system/linux-initrd.scm | 26 ++++++++++++++++++++++++-- 4 files changed, 75 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5fa68d5e5a..e2bd84493b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10364,6 +10364,24 @@ the command-line of the kernel---e.g., @code{("console=ttyS0")}. @item @code{bootloader} The system bootloader configuration object. @xref{Bootloader Configuration}. +@item @code{keyboard-layout} (default: @code{#f}) +This field specifies the keyboard layout to use in the console. It can be +either @code{#f}, in which case the default keyboard layout is used (usually +US English), or a @code{} record. + +This keyboard layout is in effect as soon as the kernel has booted. For +instance, it is the keyboard layout in effect when you type a passphrase if +your root file system is on a @code{luks-device-mapping} mapped device +(@pxref{Mapped Devices}). + +@quotation Note +This does @emph{not} specify the keyboard layout used by the bootloader, nor +that used by the graphical display server. @xref{Bootloader Configuration}, +for information on how to specify the bootloader's keyboard layout. @xref{X +Window}, for information on how to specify the keyboard layout used by the X +Window System. +@end quotation + @item @code{initrd-modules} (default: @code{%base-initrd-modules}) @cindex initrd @cindex initial RAM disk @@ -22972,6 +22990,7 @@ here is how to use it and customize it further. @cindex initial RAM disk @deffn {Scheme Procedure} raw-initrd @var{file-systems} @ [#:linux-modules '()] [#:mapped-devices '()] @ + [#:keyboard-layout #f] @ [#:helper-packages '()] [#:qemu-networking? #f] [#:volatile-root? #f] Return a derivation that builds a raw initrd. @var{file-systems} is a list of file systems to be mounted by the initrd, possibly in addition to @@ -22983,6 +23002,12 @@ the root file system specified on the kernel command line via @code{--root}. include @code{e2fsck/static} or other packages needed by the initrd to check the root file system. +When true, @var{keyboard-layout} is a @code{} record denoting +the desired console keyboard layout. This is done before @var{mapped-devices} +are set up and before @var{file-systems} are mounted such that, should the +user need to enter a passphrase or use the REPL, this happens using the +intended keyboard layout. + When @var{qemu-networking?} is true, set up networking with the standard QEMU parameters. When @var{virtio?} is true, load additional modules so that the initrd can be used as a QEMU guest with para-virtualized I/O drivers. @@ -22992,7 +23017,8 @@ to it are lost. @end deffn @deffn {Scheme Procedure} base-initrd @var{file-systems} @ - [#:mapped-devices '()] [#:qemu-networking? #f] [#:volatile-root? #f]@ + [#:mapped-devices '()] [#:keyboard-layout #f] @ + [#:qemu-networking? #f] [#:volatile-root? #f] @ [#:linux-modules '()] Return as a file-like object a generic initrd, with kernel modules taken from @var{linux}. @var{file-systems} is a list of file-systems to be @@ -23000,6 +23026,12 @@ mounted by the initrd, possibly in addition to the root file system specified on the kernel command line via @code{--root}. @var{mapped-devices} is a list of device mappings to realize before @var{file-systems} are mounted. +When true, @var{keyboard-layout} is a @code{} record denoting +the desired console keyboard layout. This is done before @var{mapped-devices} +are set up and before @var{file-systems} are mounted such that, should the +user need to enter a passphrase or use the REPL, this happens using the +intended keyboard layout. + @var{qemu-networking?} and @var{volatile-root?} behaves as in @code{raw-initrd}. The initrd is automatically populated with all the kernel modules necessary diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 44b3506284..a35d18ad7c 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. @@ -437,6 +437,7 @@ bailing out.~%root contents: ~s~%" (scandir "/")) (define* (boot-system #:key (linux-modules '()) linux-module-directory + keymap-file qemu-guest-networking? volatile-root? pre-mount @@ -444,7 +445,8 @@ bailing out.~%root contents: ~s~%" (scandir "/")) (on-error 'debug)) "This procedure is meant to be called from an initrd. Boot a system by first loading LINUX-MODULES (a list of module names) from -LINUX-MODULE-DIRECTORY, then setting up QEMU guest networking if +LINUX-MODULE-DIRECTORY, then installing KEYMAP-FILE with 'loadkeys' (if +KEYMAP-FILE is true), then setting up QEMU guest networking if QEMU-GUEST-NETWORKING? is true, calling PRE-MOUNT, mounting the file systems specified in MOUNTS, and finally booting into the new root if any. The initrd supports kernel command-line options '--load', '--root', and '--repl'. @@ -491,6 +493,15 @@ upon error." #:lookup-module lookup-module) (map lookup-module linux-modules)) + (when keymap-file + (let ((status (system* "loadkeys" keymap-file))) + (unless (zero? status) + ;; Emit a warning rather than abort when we cannot load + ;; KEYMAP-FILE. + (format (current-error-port) + "warning: 'loadkeys' exited with status ~a~%" + status)))) + (when qemu-guest-networking? (unless (configure-qemu-networking) (display "network interface is DOWN\n"))) diff --git a/gnu/system.scm b/gnu/system.scm index e6c86cb9ba..d25eb40325 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015, 2016 Alex Kost ;;; Copyright © 2016 Chris Marusich @@ -157,6 +157,8 @@ (default '())) ; list of gexps/strings (bootloader operating-system-bootloader) ; + (keyboard-layout operating-system-keyboard-layout ;#f | + (default #f)) (initrd operating-system-initrd ; (list fs) -> file-like (default base-initrd)) (initrd-modules operating-system-initrd-modules ; list of strings @@ -878,7 +880,8 @@ hardware-related operations as necessary when booting a Linux container." #:linux (operating-system-kernel os) #:linux-modules (operating-system-initrd-modules os) - #:mapped-devices mapped-devices)) + #:mapped-devices mapped-devices + #:keyboard-layout (operating-system-keyboard-layout os))) (define (locale-name->definition* name) "Variant of 'locale-name->definition' that raises an error upon failure." diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 983c6d81c8..656afd1ddb 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2016 Mark H Weaver ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2017 Mathieu Othacehe @@ -31,10 +31,13 @@ #:use-module (gnu packages disk) #:use-module (gnu packages linux) #:use-module (gnu packages guile) + #:use-module ((gnu packages xorg) + #:select (console-setup xkeyboard-config)) #:use-module ((gnu packages make-bootstrap) #:select (%guile-static-stripped)) #:use-module (gnu system file-systems) #:use-module (gnu system mapped-devices) + #:use-module (gnu system keyboard) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (ice-9 vlist) @@ -139,6 +142,7 @@ MODULES and taken from LINUX." (linux linux-libre) (linux-modules '()) (mapped-devices '()) + (keyboard-layout #f) (helper-packages '()) qemu-networking? volatile-root? @@ -152,6 +156,11 @@ mappings to realize before FILE-SYSTEMS are mounted. HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include e2fsck/static or other packages needed by the initrd to check root partition. +When true, KEYBOARD-LAYOUT is a record denoting the desired +console keyboard layout. This is done before MAPPED-DEVICES are set up and +before FILE-SYSTEMS are mounted such that, should the user need to enter a +passphrase or use the REPL, this happens using the intended keyboard layout. + When QEMU-NETWORKING? is true, set up networking with the standard QEMU parameters. @@ -206,6 +215,8 @@ upon error." (and #$@device-mapping-commands)) #:linux-modules '#$linux-modules #:linux-module-directory '#$kodir + #:keymap-file #+(and=> keyboard-layout + keyboard-layout->console-keymap) #:qemu-guest-networking? #$qemu-networking? #:volatile-root? '#$volatile-root? #:on-error '#$on-error))) @@ -290,6 +301,7 @@ FILE-SYSTEMS." (linux linux-libre) (linux-modules '()) (mapped-devices '()) + (keyboard-layout #f) qemu-networking? volatile-root? (extra-modules '()) ;deprecated @@ -300,6 +312,11 @@ mounted by the initrd, possibly in addition to the root file system specified on the kernel command line via '--root'. MAPPED-DEVICES is a list of device mappings to realize before FILE-SYSTEMS are mounted. +When true, KEYBOARD-LAYOUT is a record denoting the desired +console keyboard layout. This is done before MAPPED-DEVICES are set up and +before FILE-SYSTEMS are mounted such that, should the user need to enter a +passphrase or use the REPL, this happens using the intended keyboard layout. + QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd. The initrd is automatically populated with all the kernel modules necessary @@ -316,13 +333,18 @@ loaded at boot time in the order in which they appear." ,@extra-modules)) (define helper-packages - (file-system-packages file-systems #:volatile-root? volatile-root?)) + (append (file-system-packages file-systems + #:volatile-root? volatile-root?) + (if keyboard-layout + (list loadkeys-static) + '()))) (raw-initrd file-systems #:linux linux #:linux-modules linux-modules* #:mapped-devices mapped-devices #:helper-packages helper-packages + #:keyboard-layout keyboard-layout #:qemu-networking? qemu-networking? #:volatile-root? volatile-root? #:on-error on-error)) From patchwork Wed Mar 20 23:04:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1516 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5A5B416DB6; Wed, 20 Mar 2019 23:06:28 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id CAE5616DB6 for ; Wed, 20 Mar 2019 23:06:27 +0000 (GMT) Received: from localhost ([127.0.0.1]:56198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHz-000829-9l for patchwork@mira.cbaines.net; Wed, 20 Mar 2019 19:06:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kHh-0007sF-4P for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6kHf-0003Ro-4C for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38921) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6kHe-0003RQ-No for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6kHe-0005iS-Gt for guix-patches@gnu.org; Wed, 20 Mar 2019 19:06:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34929] [PATCH 12/12] doc: Document keyboard layout. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 20 Mar 2019 23:06:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34929@debbugs.gnu.org Received: via spool by 34929-submit@debbugs.gnu.org id=B34929.155312311121847 (code B ref 34929); Wed, 20 Mar 2019 23:06:06 +0000 Received: (at 34929) by debbugs.gnu.org; 20 Mar 2019 23:05:11 +0000 Received: from localhost ([127.0.0.1]:52459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGk-0005gD-0r for submit@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56833) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6kGd-0005da-Oo for 34929@debbugs.gnu.org; Wed, 20 Mar 2019 19:05:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6kGY-0002WA-Fu; Wed, 20 Mar 2019 19:04:58 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57670 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6kGX-0004wC-VI; Wed, 20 Mar 2019 19:04:58 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 21 Mar 2019 00:04:35 +0100 Message-Id: <20190320230435.25458-12-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320230435.25458-1-ludo@gnu.org> References: <20190320230435.25458-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi (Keyboard Layout): New node. (Bootloader Configuration): Remove examples and refer to it. (X Window): Add cross-reference. --- doc/guix.texi | 126 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 108 insertions(+), 18 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index e2bd84493b..f339d52808 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -251,6 +251,7 @@ System Configuration * File Systems:: Configuring file system mounts. * Mapped Devices:: Block device extra processing. * User Accounts:: Specifying user accounts. +* Keyboard Layout:: How the system interprets key strokes. * Locales:: Language and cultural convention settings. * Services:: Specifying system services. * Setuid Programs:: Programs running with root privileges. @@ -10091,6 +10092,7 @@ instance to support new system services. * File Systems:: Configuring file system mounts. * Mapped Devices:: Block device extra processing. * User Accounts:: Specifying user accounts. +* Keyboard Layout:: How the system interprets key strokes. * Locales:: Language and cultural convention settings. * Services:: Specifying system services. * Setuid Programs:: Programs running with root privileges. @@ -10951,6 +10953,108 @@ Note that the ``root'' account is not included here. It is a special-case and is automatically added whether or not it is specified. @end defvr +@node Keyboard Layout +@section Keyboard Layout + +To specify what each key of your keyboard does, you need to tell the operating +system what @dfn{keyboard layout} you want to use. The default, when nothing +is specified, is the US English QWERTY layout for 105-key PC keyboards. +However, German speakers will usually prefer the German QWERTZ layout, French +speakers will want the AZERTY layout, and so on; hackers might prefer Dvorak +or bépo, and they might even want to further customize the effect of some of +the keys. This section explains how to get that done. + +@cindex keyboard layout, definition +There are three components that will want to know about your keyboard layout: + +@itemize +@item +The @emph{bootloader} may want to know what keyboard layout you want to use +(@pxref{Bootloader Configuration, @code{keyboard-layout}}). This is useful if +you want, for instance, to make sure that you can type the passphrase of your +encrypted root partition using the right layout. + +@item +The @emph{operating system kernel}, Linux, will need that so that the console +is properly configured (@pxref{operating-system Reference, +@code{keyboard-layout}}). + +@item +The @emph{graphical display server}, usually Xorg, also has its own idea of +the keyboard layout (@pxref{X Window, @code{keyboard-layout}}). +@end itemize + +Guix allows you to configure all three separately but, fortunately, it allows +you to share the same keyboard layout for all three components. + +@cindex XKB, keyboard layouts +Keyboard layouts are represented by records created by the +@code{keyboard-layout} procedure of @code{(gnu system keyboard)}. Following +the X Keyboard extension (XKB), each layout has four attributes: a name (often +a language code such as ``fi'' for Finnish or ``jp'' for Japanese), an +optional variant name, an optional keyboard model name, and a possibly empty +list of additional options. In most cases the layout name is all you care +about. Here are a few example: + +@example +;; The German QWERTZ layout. Here we assume a standard +;; "pc105" keyboard model. +(keyboard-layout "de") + +;; The bépo variant of the French layout. +(keyboard-layout "fr" "bepo") + +;; The Catalan layout. +(keyboard-layout "es" "cat") + +;; The Latin American Spanish layout. In addition, the +;; "Caps Lock" keys is used as an additional "Ctrl" key, +;; and the "Menu" key is used as a "Compose" key to enter +;; accented letters. +(keyboard-layout "latam" + #:options '("ctrl:nocaps" "compose:menu")) + +;; The Russian layout for a ThinkPad keyboard. +(keyboard-layout "ru" #:model "thinkpad") + +;; The "US international" layout, which is the US layout plus +;; dead keys to enter accented characters. This is for an +;; Apple MacBook keyboard. +(keyboard-layout "us" "intl" #:model "macbook78") +@end example + +See the @file{share/X11/xkb} directory of the @code{xkeyboard-config} package +for a complete list of supported layouts, variants, and models. + +@cindex keyboard layout, configuration +Let's say you want your system to use the Turkish keyboard layout throughout +your system---bootloader, console, and Xorg. Here's what your system +configuration would look like: + +@lisp +;; Using the Turkish layout for the bootloader, the console, +;; and for Xorg. + +(operating-system + ;; ... + (keyboard-layout (keyboard-layout "tr")) ;for the console + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (target "/boot/efi") + (keyboard-layout keyboard-layout))) ;for GRUB + (services (modify-services %desktop-services + (slim-service-type config => + (slim-configuration + (inherit config) + (xorg-configuration + (xorg-configuration ;for Xorg + (keyboard-layout keyboard-layout)))))))) +@end lisp + +In the example above, for GRUB and for Xorg, we just refer to the +@code{keyboard-layout} field defined above, but we could just as well refer to +a different layout. + @node Locales @section Locales @@ -13356,7 +13460,8 @@ If this is @code{#f}, Xorg uses the default keyboard layout---usually US English (``qwerty'') for a 105-key PC keyboard. Otherwise this must be a @code{keyboard-layout} object specifying the keyboard -layout in use when Xorg is running. +layout in use when Xorg is running. @xref{Keyboard Layout}, for more +information on how to specify the keyboard layout. @item @code{extra-config} (default: @code{'()}) This is a list of strings or objects appended to the configuration file. It @@ -23130,23 +23235,8 @@ The number of seconds to wait for keyboard input before booting. Set to If this is @code{#f}, the bootloader's menu (if any) uses the default keyboard layout, usually US@tie{}English (``qwerty''). -Otherwise, this must be a @code{keyboard-layout} object. For instance, the -following example defines a standard German keyboard layout: - -@example -(keyboard-layout "de") -@end example - -@noindent -while the example below designates the bépo layout for French: - -@example -(keyboard-layout "fr" "bepo") -@end example - -The layout name and variant must match an existing layout in the -@code{xkeyboard-config} package under the @file{share/X11/xkb/symbols} -directory. +Otherwise, this must be a @code{keyboard-layout} object (@pxref{Keyboard +Layout}). @quotation Note This option is currently ignored by bootloaders other than @code{grub} and