unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#73383] [PATCH] home: home-shepherd-configuration: Add silent? field.
@ 2024-09-20 12:39 Dariqq
  2024-09-25 15:57 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Dariqq @ 2024-09-20 12:39 UTC (permalink / raw)
  To: 73383; +Cc: Dariqq

* 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(-)

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{<shepherd-service>} 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* <home-shepherd-configuration>
                (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)))))
         #~"")))

base-commit: e9d903f146865db5948abd271a5c7e763681b4e9
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#73383] [PATCH] home: home-shepherd-configuration: Add silent? field.
  2024-09-20 12:39 [bug#73383] [PATCH] home: home-shepherd-configuration: Add silent? field Dariqq
@ 2024-09-25 15:57 ` Ludovic Courtès
  2024-09-27 14:06   ` Dariqq
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2024-09-25 15:57 UTC (permalink / raw)
  To: Dariqq
  Cc: Tanguy Le Carrour, 73383, Maxim Cournoyer, paren, Florian Pelz,
	Andrew Tropin

Hi,

Dariqq <dariqq@posteo.net> skribis:

> * 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

[...]

> Related: The daemonize? field is not documented and the accessor is not being
> exported.

We should fix it.

> +@item silent? (default: @code{#f})
> +Whether or not the auto-started Shepherd should output to stdout.

Alternatively: “When true, the @command{shepherd} process does not write
anything to standard output.”

I would go as far as making it #t by default, WDYT?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#73383] [PATCH] home: home-shepherd-configuration: Add silent? field.
  2024-09-25 15:57 ` Ludovic Courtès
@ 2024-09-27 14:06   ` Dariqq
  0 siblings, 0 replies; 3+ messages in thread
From: Dariqq @ 2024-09-27 14:06 UTC (permalink / raw)
  To: Ludovic Courtès
  Cc: Tanguy Le Carrour, 73383, Maxim Cournoyer, paren, Florian Pelz,
	Andrew Tropin



On 25.09.24 17:57, Ludovic Courtès wrote:
> Hi,
> 
> Dariqq <dariqq@posteo.net> skribis:
> 
>> * 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
> 
> [...]
> 
>> Related: The daemonize? field is not documented and the accessor is not being
>> exported.
> 
> We should fix it.
> 
>> +@item silent? (default: @code{#f})
>> +Whether or not the auto-started Shepherd should output to stdout.
> 
> Alternatively: “When true, the @command{shepherd} process does not write
> anything to standard output.”

That sounds way better. I would also mention that this only does 
something when autostart? is also #t.
> 
> I would go as far as making it #t by default, WDYT?
> 
Personally I think these messages provide little value when they just 
inform me that all my home-services have started successfully 
(especially because this is also available in the log file anyway), so I 
would have no objection.

Not sure how others feel about them. Probably most dont see them at all 
when they launch directly into their de/wm.

> Thanks,
> Ludo’.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-27 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 12:39 [bug#73383] [PATCH] home: home-shepherd-configuration: Add silent? field Dariqq
2024-09-25 15:57 ` Ludovic Courtès
2024-09-27 14:06   ` Dariqq

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).