From ff9522fb69b9f4a31a5b766029e26dc53a2d1cf8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 2 Aug 2022 23:27:52 +0200 Subject: installer: Add comments and vertical space to the generated config. * 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/services.scm | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'gnu/installer/services.scm') 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)))))) -- cgit v1.2.3