From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cCHlHy2b6WLhZQEAbAwnHQ (envelope-from ) for ; Tue, 02 Aug 2022 23:46:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 0LfzHy2b6WJdqAAA9RJhRA (envelope-from ) for ; Tue, 02 Aug 2022 23:46:21 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 211133D03F for ; Tue, 2 Aug 2022 23:46:21 +0200 (CEST) Received: from localhost ([::1]:58582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIziW-00023e-5X for larch@yhetil.org; Tue, 02 Aug 2022 17:46:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIzhL-0001zV-CH for guix-patches@gnu.org; Tue, 02 Aug 2022 17:45:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55566) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIzhL-0006R7-1l for guix-patches@gnu.org; Tue, 02 Aug 2022 17:45:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIzhK-0003Ak-VL for guix-patches@gnu.org; Tue, 02 Aug 2022 17:45:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56898] [PATCH 13/13] installer: Add comments and vertical space to the generated config. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Aug 2022 21:45:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56898 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56898@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 56898-submit@debbugs.gnu.org id=B56898.165947668812060 (code B ref 56898); Tue, 02 Aug 2022 21:45:06 +0000 Received: (at 56898) by debbugs.gnu.org; 2 Aug 2022 21:44:48 +0000 Received: from localhost ([127.0.0.1]:45303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIzh1-00038M-7e for submit@debbugs.gnu.org; Tue, 02 Aug 2022 17:44:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIzgv-00036D-Oq for 56898@debbugs.gnu.org; Tue, 02 Aug 2022 17:44:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55174) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIzgp-0006B3-F0; Tue, 02 Aug 2022 17:44:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=FHoCYsvF8v+XMo+G3Itq/oQ0CX6ynZFLVsxZAp4BVHk=; b=C1hpdUgmDzcqV+GjvyQT hrXLrI7Jac8g/7EuVd6uvsRHJH9W96QMlmGxWUTVkuqSmme0mezzkfbOT5odbNBTvn9rJ1Y4J+B/m krB55lRAgR5l82j4NDIkHrrxy4BdiadZFRVR5ImH4qNsRmG63A4PNL9YR5Vvmucfh0c3aL/85myYg 2aQH0P1kFWP37erT2ffzQokGMtx7rfyVHVUeXbywJrUbOPxl4sKLWJNOvRWH3qHVK0iAC1b2MjY+a H/g99nlbfybT5/8tFNey6UV+sBNX51B6TgzDfu1Hi8P7bX1cCQYt6sqEAcpI0xOK+pgU/OuqB7glL lQeoRyi3I6uOuw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:52235 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIzgo-0006W4-TI; Tue, 02 Aug 2022 17:44:35 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 2 Aug 2022 23:44:19 +0200 Message-Id: <20220802214419.19013-13-ludo@gnu.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220802214419.19013-1-ludo@gnu.org> References: <20220802214419.19013-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659476781; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=FHoCYsvF8v+XMo+G3Itq/oQ0CX6ynZFLVsxZAp4BVHk=; b=UD3K0EY9unzpAituKQS8hO01v0/PuTBvGh//4S5LHsLUmBhtPHCFWa5J6CWkoz5p3K3cei zx4j8HPa4EyDRFaIOMOxMK8Bmoa4WEtInh2ruoWEb63hPj18RThW2TWNYYrc2RUQzrGVu7 9iqNb0Y7y6iFDQLVEIPm/3f2KC3rWvDlzXEoieKO1F5VNjgmCfcwZgEShRtjZFmJbhJU0T S7WUhkHYibbowNlmM2mtHMiGWXav1L+TlNua7DzPgjnlj5Po0NUdXgQa5Q74SJDlrOyZzk rW9Antjzh3MAgPNvsIJOYwA1NgLXvgkU1eVegzun2fObz0z/r7+8R7JfbJrBlw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659476781; a=rsa-sha256; cv=none; b=ZTKOL4n7/QsS+AdZLPhHTk+dxTK26Ujus9xoNCOl9ZHDAx0sSleBK6AnkbBUW1opIc97Kv 44DKL2b8CZrwjHL/TE3pYccySJ4ByHY5kC8r0aNAfIgIpvUbaHiI9E48pixZtnZ4+R2rTW OV3ECipz+edrUcCtvGpruSibLwRweWOalJc5OHIeMOf4wU21hE2cPCGa5ZFeg0UvrAf5Ap WDkwsouhARoRR1n5iSIEPAp16GcSiDeZXk6z4q4I+BLt9RVoODlKF2lYmsxRSCMpJo/Mri WS8gGjB7tRA7FtAbFn3pjopdRi5bInjSpunIdAi9+ET+sxq/Qd5DNZRStf9cCQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=C1hpdUgm; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=C1hpdUgm; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 211133D03F X-Spam-Score: -3.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: Qk1kuRrpHcEp * gnu/installer/parted.scm (user-partitions->configuration): Introduce vertical space and a comment. * gnu/installer/services.scm (G_): New macro. (%system-services): Add comment for OpenSSH. (system-services->configuration): Add vertical space and comments. * gnu/installer/user.scm (users->configuration): Add comment. * gnu/installer/steps.scm (format-configuration): Add comment. (configuration->file): Expound leading comment. Pass #:format-comment to 'pretty-print-with-comments/splice'. --- gnu/installer/parted.scm | 10 +++++++++- gnu/installer/services.scm | 39 ++++++++++++++++++++++++++++++-------- gnu/installer/steps.scm | 22 +++++++++++++++++---- gnu/installer/user.scm | 7 ++++++- 4 files changed, 64 insertions(+), 14 deletions(-) diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index 94ef9b42bc..9a57d13452 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018, 2019 Mathieu Othacehe -;;; Copyright © 2019, 2020 Ludovic Courtès +;;; Copyright © 2019, 2020, 2022 Ludovic Courtès ;;; Copyright © 2020 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. @@ -38,6 +38,7 @@ (define-module (gnu installer parted) #:select (%base-initrd-modules)) #:use-module (guix build syscalls) #:use-module (guix build utils) + #:use-module (guix read-print) #:use-module (guix records) #:use-module (guix utils) #:use-module (guix i18n) @@ -1439,6 +1440,13 @@ (define (user-partitions->configuration user-partitions) `((mapped-devices (list ,@(map user-partition->mapped-device encrypted-partitions))))) + + ,(vertical-space 1) + ,(let-syntax ((G_ (syntax-rules () ((_ str) str)))) + (comment (G_ "\ +;; The list of file systems that get \"mounted\". The unique +;; file system identifiers there (\"UUIDs\") can be obtained +;; by running 'blkid' in a terminal.\n"))) (file-systems (cons* ,@(user-partitions->file-systems user-partitions) %base-file-systems))))) diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index 6584fcceec..6c5f49622f 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Mathieu Othacehe -;;; Copyright © 2019 Ludovic Courtès +;;; Copyright © 2019, 2022 Ludovic Courtès ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2021 Tobias Geerinckx-Rice ;;; Copyright © 2021 Leo Famulari @@ -22,6 +22,7 @@ (define-module (gnu installer services) #:use-module (guix records) + #:use-module (guix read-print) #:use-module (srfi srfi-1) #:export (system-service? system-service-name @@ -35,6 +36,11 @@ (define-module (gnu installer services) %system-services system-services->configuration)) +(define-syntax-rule (G_ str) + ;; In this file, translatable strings are annotated with 'G_' so xgettext + ;; catches them, but translation happens later on at run time. + str) + (define-record-type* system-service make-system-service system-service? @@ -52,9 +58,7 @@ (define %system-services ((_ fields ...) (system-service (type 'desktop) - fields ...)))) - (G_ (syntax-rules () ;for xgettext - ((_ str) str)))) + fields ...))))) (list ;; This is the list of desktop environments supported as services. (desktop-environment @@ -94,7 +98,12 @@ (define %system-services (system-service (name (G_ "OpenSSH secure shell daemon (sshd)")) (type 'networking) - (snippet '((service openssh-service-type)))) + (snippet `(,(vertical-space 1) + ,(comment + (G_ "\ +;; To configure OpenSSH, pass an 'openssh-configuration' +;; record as a second argument to 'service' below.\n")) + (service openssh-service-type)))) (system-service (name (G_ "Tor anonymous network router")) (type 'networking) @@ -149,24 +158,38 @@ (define (system-services->configuration services) (desktop? (find desktop-system-service? services)) (base (if desktop? '%desktop-services - '%base-services))) + '%base-services)) + (heading (list (vertical-space 1) + (comment (G_ "\ +;; Below is the list of system services. To search for available +;; services, run 'guix system search KEYWORD' in a terminal.\n"))))) + (if (null? snippets) `(,@(if (null? packages) '() `((packages (append (list ,@packages) %base-packages)))) + + ,@heading (services ,base)) `(,@(if (null? packages) '() `((packages (append (list ,@packages) %base-packages)))) + + ,@heading (services (append (list ,@snippets ,@(if desktop? ;; XXX: Assume 'keyboard-layout' is in ;; scope. - '((set-xorg-configuration + `((set-xorg-configuration (xorg-configuration (keyboard-layout keyboard-layout)))) '())) - ,base)))))) + + ,(vertical-space 1) + ,(comment (G_ "\ +;; This is the default list of services we +;; are appending to.\n")) + ,base)))))) diff --git a/gnu/installer/steps.scm b/gnu/installer/steps.scm index f1d61a2bc5..8b25ae97c8 100644 --- a/gnu/installer/steps.scm +++ b/gnu/installer/steps.scm @@ -224,10 +224,14 @@ (define (format-configuration steps results) (conf-formatter result-step) '()))) steps)) - (modules '((use-modules (gnu)) + (modules `(,(vertical-space 1) + ,(comment (G_ "\ +;; Indicate which modules to import to access the variables +;; used in this configuration.\n")) + (use-modules (gnu)) (use-service-modules cups desktop networking ssh xorg)))) `(,@modules - () + ,(vertical-space 1) (operating-system ,@configuration)))) (define* (configuration->file configuration @@ -241,11 +245,21 @@ (define* (configuration->file configuration ;; length below 60 characters. (display (G_ "\ ;; This is an operating system configuration generated -;; by the graphical installer.\n") +;; by the graphical installer. +;; +;; Once installation is complete, you can learn and modify +;; this file to tweak the system configuration, and pass it +;; to the 'guix system reconfigure' command to effect your +;; changes.\n") port) (newline port) (pretty-print-with-comments/splice port configuration - #:max-width 75) + #:max-width 75 + #:format-comment + (lambda (c indent) + ;; Localize C. + (comment (G_ (comment->string c)) + (comment-margin? c)))) (flush-output-port port)))) diff --git a/gnu/installer/user.scm b/gnu/installer/user.scm index c894a91dc8..224040530c 100644 --- a/gnu/installer/user.scm +++ b/gnu/installer/user.scm @@ -18,6 +18,7 @@ (define-module (gnu installer user) #:use-module (guix records) + #:use-module (guix read-print) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-9 gnu) @@ -69,7 +70,11 @@ (define (user->sexp user) (supplementary-groups '("wheel" "netdev" "audio" "video")))) - `((users (cons* + (define-syntax-rule (G_ str) str) + + `(,(vertical-space 1) + ,(comment (G_ ";; The list of user accounts ('root' is implicit).\n")) + (users (cons* ,@(filter-map (lambda (user) ;; Do not emit a 'user-account' form for "root". (and (not (string=? (user-name user) "root")) -- 2.37.1