all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#62584] [PATCH] services: Add error/success service type.
@ 2023-04-01  7:28 Ludovic Courtès
  2023-04-01 10:34 ` 宋文武 via Guix-patches via
  2023-04-27  3:53 ` Jakob Honal
  0 siblings, 2 replies; 8+ messages in thread
From: Ludovic Courtès @ 2023-04-01  7:28 UTC (permalink / raw)
  To: 62584; +Cc: Ludovic Courtès

* gnu/services/base.scm (error/success-boot-gexp): New procedure.
(error/success-service-type): New variable.
(%base-services): Add an instance of it.
* doc/guix.texi (Base Services): Document it.
---
 doc/guix.texi         | 26 ++++++++++++++++++++++++++
 gnu/services/base.scm | 27 +++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)

Hello Guix!

A while back, we committed a change that removed the boot-time
message we’d been seeing, “error in finalization thread: Success”:

  https://git.savannah.gnu.org/cgit/guix.git/commit/?id=168a7933c0e138dc7061a3f0dc96871e16da5c5f

This change was not universally acclaimed.  Some complained that
the boot process had seemingly become opaque because it’s now harder
to tell whether it’s making progress successfully, while others
were disappointed that their newly acquired sticker had become
obsolete.

This patch reinstates that message.  The previous implementation
worked by closing a file descriptor that Guile relied on internally.
The new implementation takes a different approach, with the
error-reporting device implemented right into the service, which
should give us more flexibility—e.g., the service could be extended
to report other error codes.

The new ‘error/success-service-type’ is added to ‘%base-services’,
the default list of system services.  I think it’s good to have it
by default, but that’s something we can discuss.

Feedback welcome!

Ludo’.

diff --git a/doc/guix.texi b/doc/guix.texi
index a58ea8f9ec..605ed648c4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19007,6 +19007,32 @@ about the Pluggable Authentication Module (PAM) limits, refer to the
 @samp{pam_limits} man page from the @code{linux-pam} package.
 @end defvar
 
+@cindex success, and error (service type)
+@cindex error, and success (service type)
+
+@defvar error/success-service-type
+This is the service type for the iconic ``error in finalization thread:
+Success'' boot-time message that long-time Guix System users are
+familiar with.  It is part of @code{%base-services} (enabled by
+default).
+
+New users who do not feel the need for this service can disable it by
+filtering it out of their service list.  For instance, if you are using
+@code{%desktop-services}, you can change your operating system
+configuration like so (@pxref{Service Reference,
+@code{modify-services}}):
+
+@lisp
+(operating-system
+  ;; @dots{}
+  (services (modify-services %desktop-services
+              (delete error/success-service-type))))
+@end lisp
+
+However, we do not recommend it as you could lose sight of how weird and
+beautiful your system is.
+@end defvar
+
 @defvar greetd-service-type
 @uref{https://git.sr.ht/~kennylevinsen/greetd, @code{greetd}} is a minimal and
 flexible login manager daemon, that makes no assumptions about what you
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index e063828d3b..5479cd63cf 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -248,6 +248,8 @@ (define-module (gnu services base)
             pam-limits-service-type
             pam-limits-service  ; deprecated
 
+            error/success-service-type
+
             greetd-service-type
             greetd-configuration
             greetd-terminal-configuration
@@ -2990,6 +2992,29 @@ (define %qemu-static-networking
    (provision '(networking))
    (name-servers '("10.0.2.3"))))
 
+\f
+;;;
+;;; The iconic error/success message service.
+;;;
+
+(define (error/success-boot-gexp _)
+  #~(begin
+      (display "error in finalization thread: Success\n"
+               (current-error-port))
+      (sleep 2)))           ;let the user notice--all this hasn't been in vain
+
+(define error/success-service-type
+  (service-type
+   (name 'error/success)
+   (extensions
+    (list (service-extension boot-service-type
+                             error/success-boot-gexp)))
+   (default-value 42)
+   (description
+    "This service prints the iconic error/success message at boot time.  The
+message acts as a lighthouse for seasoned users--and seasoned users to
+be!--who immediately know, when they see it, that everything's alright.")))
+
 \f
 ;;;
 ;;; greetd-service-type -- minimal and flexible login manager daemon
@@ -3364,6 +3389,8 @@ (define %base-services
 
         (service sysctl-service-type)
 
+        (service error/success-service-type)
+
         (service special-files-service-type
                  `(("/bin/sh" ,(file-append bash "/bin/sh"))
                    ("/usr/bin/env" ,(file-append coreutils "/bin/env"))))))
-- 
2.39.2





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

end of thread, other threads:[~2023-04-27 13:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-01  7:28 [bug#62584] [PATCH] services: Add error/success service type Ludovic Courtès
2023-04-01 10:34 ` 宋文武 via Guix-patches via
2023-04-01 16:51   ` Ludovic Courtès
2023-04-01 16:52   ` Ludovic Courtès
2023-04-02 13:32     ` Ludovic Courtès
2023-04-03  9:48       ` 宋文武 via Guix-patches via
2023-04-04 10:59       ` Simon Tournier
2023-04-27  3:53 ` Jakob Honal

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.