From patchwork Fri Sep 20 12:39:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariqq X-Patchwork-Id: 68176 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 1C1A827BBE9; Fri, 20 Sep 2024 14:04:06 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E725A27BBE2 for ; Fri, 20 Sep 2024 14:04:03 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srdIY-0005qO-75; Fri, 20 Sep 2024 09:03:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srdIW-0005qB-JC for guix-patches@gnu.org; Fri, 20 Sep 2024 09:03:45 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srdIW-0002Od-AO for guix-patches@gnu.org; Fri, 20 Sep 2024 09:03:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=ynMeSiIfiNYKdS1npZdASb9aWd+nBvIRDoUG4R1d+rA=; b=M7NbVRmYld3sPUAgAjs12FRFVK3oNjinYGJXXjZwqATFvnGWktwZXF9tW78mSY+dAuS+bNIoDisFGDwdOvN7m7SusXywvYRDMTvz/j0inahSDkK3IW8VGQxxSsQjNbVzSOjZbMJY5E27IZ+lBc8nPBNmFaZGgsqprJoFgCVHYNexLcdzBHTqhW3wQv/Payk7za87C/KhnJjoFFcngB3dR6+ZecjpZhnW4v+arPYLmZ4j8AJOnr+KV9/x29TBhSkkumHdqZP/KnVkz3hJ8+eHCsT/djX22MIVWSgKlaN+y93NPH6e2yWsPD2huM5nyAPmB4MkR/B6P7bxJ36rbPWHOg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srdIo-00011P-LJ for guix-patches@gnu.org; Fri, 20 Sep 2024 09:04:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73383] [PATCH] home: home-shepherd-configuration: Add silent? field. Resent-From: Dariqq Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Fri, 20 Sep 2024 13:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73383 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73383@debbugs.gnu.org Cc: Dariqq , ( , Andrew Tropin , Florian Pelz , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Tanguy Le Carrour X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ( , Andrew Tropin , Florian Pelz , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Tanguy Le Carrour Received: via spool by submit@debbugs.gnu.org id=B.17268374183889 (code B ref -1); Fri, 20 Sep 2024 13:04:02 +0000 Received: (at submit) by debbugs.gnu.org; 20 Sep 2024 13:03:38 +0000 Received: from localhost ([127.0.0.1]:34347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srdIM-00010Z-0N for submit@debbugs.gnu.org; Fri, 20 Sep 2024 09:03:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:54176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srdIK-00010R-5c for submit@debbugs.gnu.org; Fri, 20 Sep 2024 09:03:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srdI0-0005nV-Re for guix-patches@gnu.org; Fri, 20 Sep 2024 09:03:13 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srdHy-0002Mw-MW for guix-patches@gnu.org; Fri, 20 Sep 2024 09:03:12 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id CDE45240104 for ; Fri, 20 Sep 2024 15:03:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1726837386; bh=uERdxSaua7180I7dwOsDx4Ic7NcPS0f6ltSNz3B+04g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=qBPXC4CW67iypA0LFKmK+AGEbBO/eQ37OE4NiLu5Ag1O8rc7LJBmIFunKa69jfgtH ytqV4gjPBDeAnBb+9tPrqp3/wQty6l1SNWTkgmS0+pB8idvfkC7cfuRgSpq34F/FQp 4UdTkR+Ekh53m9Je657qPD3B9lI6m84rXBf5Pmb2VoSN76cY/vRmRsAxTApXXAEsib 1UZ/j0ySqd7Hwr1z/oOBoappsvwbAioxLxchst4NQp0AiuysxA6LDF/YXw8MLg35Hl q8IHVMcf74LgRwLlGpn7PNv2bHf2fnxTGXjAbePdayFyxW4g9CdGzBQ8PbnHjFOS8E aKkBHBkFvwx6Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4X9CHG20Q3z9rxG; Fri, 20 Sep 2024 15:03:06 +0200 (CEST) From: Dariqq Date: Fri, 20 Sep 2024 12:39:23 +0000 Message-ID: MIME-Version: 1.0 Received-SPF: pass client-ip=185.67.36.66; envelope-from=dariqq@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/home/services/shepherd.scm (home-shepherd-configuration): Add silent? field. (launch-shepherd-gexp): Conditionally invoke shepherd with --silent. * doc/guix.texi (home-shepherd-configuration): Document it. Change-Id: I1ce7a92c2777ebded39fe293b0bdcbd03562b4fc --- Hi, This adds a configuration field to the home-shepherd to optionally invoke it with --silent. See [1] for details. The option currently only actually works as advertised when using the development branch of shepherd, for the current version (v0.10.5) the --silent parameter is ignored. I have set the default value to #f to not change the current behaviour. For the documentation I am not perfectly happy with my description because the behaviour is opposite of the description (Setting to #t causes no output to stdout), maybe there is a better way to phrase this? Also is there a better way to communicate that it only works when the auto-start? field is also #t? Related: The daemonize? field is not documented and the accessor is not being exported. [1] https://issues.guix.gnu.org/72277 doc/guix.texi | 3 +++ gnu/home/services/shepherd.scm | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) base-commit: e9d903f146865db5948abd271a5c7e763681b4e9 diff --git a/doc/guix.texi b/doc/guix.texi index 52e36e4354..ab8cf54ae8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -46057,6 +46057,9 @@ Shepherd Home Service @item auto-start? (default: @code{#t}) Whether or not to start Shepherd on first login. +@item silent? (default: @code{#f}) +Whether or not the auto-started Shepherd should output to stdout. + @item services (default: @code{'()}) A list of @code{} to start. You should probably use the service extension diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm index dfe4030a4e..17b005ed71 100644 --- a/gnu/home/services/shepherd.scm +++ b/gnu/home/services/shepherd.scm @@ -32,6 +32,7 @@ (define-module (gnu home services shepherd) home-shepherd-configuration? home-shepherd-configuration-shepherd home-shepherd-configuration-auto-start? + home-shepherd-configuration-silent? home-shepherd-configuration-services) #:re-export (shepherd-service shepherd-service? @@ -58,6 +59,8 @@ (define-record-type* (default #t)) (daemonize? home-shepherd-configuration-daemonize? (default #t)) + (silent? home-shepherd-configuration-silent? + (default #f)) (services home-shepherd-configuration-services (default '()))) @@ -107,7 +110,8 @@ (define (home-shepherd-configuration-file config) (scheme-file "shepherd.conf" config))) (define (launch-shepherd-gexp config) - (let* ((shepherd (home-shepherd-configuration-shepherd config))) + (let* ((shepherd (home-shepherd-configuration-shepherd config)) + (silent? (home-shepherd-configuration-silent? config))) (if (home-shepherd-configuration-auto-start? config) (with-imported-modules '((guix build utils)) #~(unless (file-exists? @@ -125,6 +129,7 @@ (define (launch-shepherd-gexp config) #$(file-append shepherd "/bin/shepherd") "--logfile" (string-append log-dir "/shepherd.log") + #$@(if silent? '("--silent") '()) "--config" #$(home-shepherd-configuration-file config))))) #~"")))