From patchwork Sun Nov 7 11:36:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 34293 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 6B6CA27BBE3; Sun, 7 Nov 2021 11:37:39 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D065427BBE1 for ; Sun, 7 Nov 2021 11:37:38 +0000 (GMT) Received: from localhost ([::1]:50012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjgUU-0001qt-1q for patchwork@mira.cbaines.net; Sun, 07 Nov 2021 06:37:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjgTw-0001ZK-BR for guix-patches@gnu.org; Sun, 07 Nov 2021 06:37:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mjgTu-00063q-W4 for guix-patches@gnu.org; Sun, 07 Nov 2021 06:37:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mjgTu-0004XE-UL for guix-patches@gnu.org; Sun, 07 Nov 2021 06:37:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51543] [PATCH v3 2/2] doc: Improve documentation of the Bash home service Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 07 Nov 2021 11:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51543 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51543@debbugs.gnu.org Cc: Liliana Marie Prikler Received: via spool by 51543-submit@debbugs.gnu.org id=B51543.163628500617391 (code B ref 51543); Sun, 07 Nov 2021 11:37:02 +0000 Received: (at 51543) by debbugs.gnu.org; 7 Nov 2021 11:36:46 +0000 Received: from localhost ([127.0.0.1]:51944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjgTW-0004WF-GE for submit@debbugs.gnu.org; Sun, 07 Nov 2021 06:36:45 -0500 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:49780 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjgTT-0004W2-89 for 51543@debbugs.gnu.org; Sun, 07 Nov 2021 06:36:36 -0500 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1636284989; bh=lMffuArsVcCmu18iEZfuSTf1rEFtaLT8ofBbz2IKIkA=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=gzjud+RL5+guLXRK8F8wAy/TUGynEQFhe6kC8xavzhfVkov3SEASqoOOxv0XqYpkY jDQaZVzteFgjyJrlu+JRsqXYpza+f4d6vCQ6AWM9MJCOqPrDXSqvjufV8VFFy9dWhn 5H92I1kv06CrJTJwKnvmXypbO+pmTQvWQW/5T9bI= In-Reply-To: References: Message-Id: <8945ebff245fc62c8ba59133e3116b6f68d0aa9c.1636284793.git.public@yoctocell.xyz> Date: Sun, 07 Nov 2021 12:36:29 +0100 MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi (Shells Home Services): Document ‘home-bash-extension’ configuration record. * gnu/home/services/shells.scm (generate-home-bash-documentation): Extract docstrings from ‘home-bash-extension’. (home-bash-configuration): Expound on docstrings. (home-bash-extension): Likewise. Fixes: --- doc/guix.texi | 50 ++++++++++++++++++++++++++++++++---- gnu/home/services/shells.scm | 45 ++++++++++++++++++++++---------- 2 files changed, 76 insertions(+), 19 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index f7312a5b30..db1bf6efa7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -36159,6 +36159,7 @@ @subsubheading Bash Home Service +@anchor{home-bash-configuration} @deftp {Data Type} home-bash-configuration Available @code{home-bash-configuration} fields are: @@ -36167,15 +36168,20 @@ The Bash package to use. @item @code{guix-defaults?} (default: @code{#t}) (type: boolean) -Add sane defaults like reading @file{/etc/bashrc}, coloring output for -@code{ls} provided by guix to @file{.bashrc}. +Add sane defaults like reading @file{/etc/bashrc} and coloring the output of +@command{ls} to the end of the @file{.bashrc} file. @item @code{environment-variables} (default: @code{()}) (type: alist) -Association list of environment variables to set for the Bash session. +Association list of environment variables to set for the Bash session. The +rules for the @code{home-environment-variables-service-type} apply +here (@pxref{Essential Home Services}). The contents of this field will be +added after the contents of the @code{bash-profile} field. @item @code{aliases} (default: @code{()}) (type: alist) -Association list of aliases to set for the Bash session. The alias will -automatically be quoted, so something line this: +Association list of aliases to set for the Bash session. The aliases +will be defined after the contents of the @code{bashrc} field has been +put in the @file{.bashrc} file. The alias will automatically be quoted, +so something line this: @lisp '((\"ls\" . \"ls -alF\")) @@ -36206,7 +36212,41 @@ process for example). @end table +@end deftp + +You can extend the Bash service by using the @code{home-bash-extension} +configuration record, whose fields most mirror that of +@code{home-bash-configuration} (@pxref{home-bash-configuration}). The +contents of the extensions will be added to the end of the corresponding +Bash configuration files (@pxref{Bash Startup Files,,, bash, The GNU +Bash Reference Manual}. + +@deftp {Data Type} home-bash-extension +Available @code{home-bash-extension} fields are: + +@table @asis +@item @code{environment-variables} (default: @code{()}) (type: alist) +Additional environment variables to set. These will be combined with the +environment variables from other extensions and the base service to form one +coherent block of environment variables. + +@item @code{aliases} (default: @code{()}) (type: alist) +Additional aliases to set. These will be combined with the aliases from +other extensions and the base service. +@item @code{bash-profile} (default: @code{()}) (type: text-config) +Additional text blocks to add to @file{.bash_profile}, which will be combined +with text blocks from other extensions and the base service. + +@item @code{bashrc} (default: @code{()}) (type: text-config) +Additional text blocks to add to @file{.bashrc}, which will be combined +with text blocks from other extensions and the base service. + +@item @code{bash-logout} (default: @code{()}) (type: text-config) +Additional text blocks to add to @file{.bash_logout}, which will be combined +with text blocks from other extensions and the base service. + +@end table @end deftp @subsubheading Zsh Home Service diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index f24e47f762..81d07da86c 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -323,16 +323,21 @@ (define-configuration home-bash-configuration "The Bash package to use.") (guix-defaults? (boolean #t) - "Add sane defaults like reading @file{/etc/bashrc}, coloring output -for @code{ls} provided by guix to @file{.bashrc}.") + "Add sane defaults like reading @file{/etc/bashrc} and coloring the output of +@command{ls} to the end of the @file{.bashrc} file.") (environment-variables (alist '()) - "Association list of environment variables to set for the Bash session." + "Association list of environment variables to set for the Bash session. The +rules for the @code{home-environment-variables-service-type} apply +here (@pxref{Essential Home Services}). The contents of this field will be +added after the contents of the @code{bash-profile} field." serialize-posix-env-vars) (aliases (alist '()) - "Association list of aliases to set for the Bash session. The alias will -automatically be quoted, so something line this: + "Association list of aliases to set for the Bash session. The aliases will be +defined after the contents of the @code{bashrc} field has been put in the +@file{.bashrc} file. The alias will automatically be quoted, so something line +this: @lisp '((\"ls\" . \"ls -alF\")) @@ -450,19 +455,25 @@ (define (add-bash-packages config) (define-configuration/no-serialization home-bash-extension (environment-variables (alist '()) - "Association list of environment variables to set.") + "Additional environment variables to set. These will be combined with the +environment variables from other extensions and the base service to form one +coherent block of environment variables.") (aliases (alist '()) - "Association list of aliases to set.") + "Additional aliases to set. These will be combined with the aliases from +other extensions and the base service.") (bash-profile (text-config '()) - "List of file-like objects.") + "Additional text blocks to add to @file{.bash_profile}, which will be combined +with text blocks from other extensions and the base service.") (bashrc (text-config '()) - "List of file-like objects.") + "Additional text blocks to add to @file{.bashrc}, which will be combined +with text blocks from other extensions and the base service.") (bash-logout (text-config '()) - "List of file-like objects.")) + "Additional text blocks to add to @file{.bash_logout}, which will be combined +with text blocks from other extensions and the base service.")) (define (home-bash-extensions original-config extension-configs) (match original-config @@ -646,10 +657,16 @@ (define (generate-home-shell-profile-documentation) 'home-shell-profile-configuration)) (define (generate-home-bash-documentation) - (generate-documentation - `((home-bash-configuration - ,home-bash-configuration-fields)) - 'home-bash-configuration)) + (string-append + (generate-documentation + `((home-bash-configuration + ,home-bash-configuration-fields)) + 'home-bash-configuration) + "\n\n" + (generate-documentation + `((home-bash-extension + ,home-bash-extension-fields)) + 'home-bash-extension))) (define (generate-home-zsh-documentation) (generate-documentation