unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
@ 2022-04-17 10:01 Liliana Marie Prikler
  2022-04-17 10:01 ` [bug#54986] [PATCH v2 1/3] " Liliana Marie Prikler
                   ` (5 more replies)
  0 siblings, 6 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-17 10:01 UTC (permalink / raw)
  To: 54986

* gnu/packages/mpd.scm (mpd)[#:configure-flags]: Convert to G-Expression.
Add “-Dsystemd=enabled”.
[#:phases]: New argument.
[inputs]: Add elogind.
---
 gnu/packages/mpd.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/mpd.scm b/gnu/packages/mpd.scm
index 1ee6806735..40e6a99ad7 100644
--- a/gnu/packages/mpd.scm
+++ b/gnu/packages/mpd.scm
@@ -47,6 +47,7 @@ (define-module (gnu packages mpd)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages cdrom)
   #:use-module (gnu packages cmake) ;for MPD
+  #:use-module (gnu packages freedesktop) ;elogind
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
@@ -119,12 +120,28 @@ (define-public mpd
                 "1v969w7h3660ph3h2bdlkrzc05pfz95bmxjqdbzzf7pfwf795ifb"))))
     (build-system meson-build-system)
     (arguments
-     `(#:configure-flags '("-Ddocumentation=enabled")))
+     (list
+      #:configure-flags #~(list "-Ddocumentation=enabled"
+                                "-Dsystemd=enabled")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'enable-elogind
+            (lambda _
+              (substitute* "src/lib/systemd/meson.build"
+                (("libsystemd") "libelogind"))
+              ;; XXX: systemd dependency overwritten internally, leads to bad
+              ;;      errors
+              (substitute* "src/lib/systemd/meson.build"
+                (("systemd_dep = declare_dependency" all)
+                 (string-append "_" all)))
+              (substitute* "meson.build"
+                (("systemd_dep,") "systemd_dep, _systemd_dep,")))))))
     (inputs (list ao
                   alsa-lib
                   avahi
                   boost
                   curl
+                  elogind
                   ffmpeg
                   flac
                   fmt
-- 
2.35.1





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

* [bug#54986] [PATCH v2 1/3] gnu: mpd: Add support for socket activation.
  2022-04-17 10:01 [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Liliana Marie Prikler
@ 2022-04-17 10:01 ` Liliana Marie Prikler
  2022-04-17 21:06 ` [bug#54986] [PATCH] " Ludovic Courtès
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-17 10:01 UTC (permalink / raw)
  To: 54986; +Cc: ludo

* gnu/packages/mpd.scm (mpd)[#:configure-flags]: Convert to G-Expression.
Add “-Dsystemd=enabled”.
[#:phases]: New argument.
[inputs]: Add elogind.
---
 gnu/packages/mpd.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/mpd.scm b/gnu/packages/mpd.scm
index 1ee6806735..40e6a99ad7 100644
--- a/gnu/packages/mpd.scm
+++ b/gnu/packages/mpd.scm
@@ -47,6 +47,7 @@ (define-module (gnu packages mpd)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages cdrom)
   #:use-module (gnu packages cmake) ;for MPD
+  #:use-module (gnu packages freedesktop) ;elogind
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
@@ -119,12 +120,28 @@ (define-public mpd
                 "1v969w7h3660ph3h2bdlkrzc05pfz95bmxjqdbzzf7pfwf795ifb"))))
     (build-system meson-build-system)
     (arguments
-     `(#:configure-flags '("-Ddocumentation=enabled")))
+     (list
+      #:configure-flags #~(list "-Ddocumentation=enabled"
+                                "-Dsystemd=enabled")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'enable-elogind
+            (lambda _
+              (substitute* "src/lib/systemd/meson.build"
+                (("libsystemd") "libelogind"))
+              ;; XXX: systemd dependency overwritten internally, leads to bad
+              ;;      errors
+              (substitute* "src/lib/systemd/meson.build"
+                (("systemd_dep = declare_dependency" all)
+                 (string-append "_" all)))
+              (substitute* "meson.build"
+                (("systemd_dep,") "systemd_dep, _systemd_dep,")))))))
     (inputs (list ao
                   alsa-lib
                   avahi
                   boost
                   curl
+                  elogind
                   ffmpeg
                   flac
                   fmt
-- 
2.35.1





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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-04-17 10:01 [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Liliana Marie Prikler
  2022-04-17 10:01 ` [bug#54986] [PATCH v2 1/3] " Liliana Marie Prikler
@ 2022-04-17 21:06 ` Ludovic Courtès
  2022-04-17 21:57   ` Liliana Marie Prikler
  2022-04-23 14:25 ` [bug#54986] [PATCH v2 2/3 WIP] services: shepherd: Add support for socket activation endpoints Liliana Marie Prikler
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2022-04-17 21:06 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986

Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> * gnu/packages/mpd.scm (mpd)[#:configure-flags]: Convert to G-Expression.
> Add “-Dsystemd=enabled”.
> [#:phases]: New argument.
> [inputs]: Add elogind.

LGTM!

Are you planning to update the service as well?

Thanks,
Ludo’.




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-04-17 21:06 ` [bug#54986] [PATCH] " Ludovic Courtès
@ 2022-04-17 21:57   ` Liliana Marie Prikler
  2022-04-18 21:05     ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-17 21:57 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54986

Am Sonntag, dem 17.04.2022 um 23:06 +0200 schrieb Ludovic Courtès:
> Hi,
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:
> 
> > * gnu/packages/mpd.scm (mpd)[#:configure-flags]: Convert to G-
> > Expression.
> > Add “-Dsystemd=enabled”.
> > [#:phases]: New argument.
> > [inputs]: Add elogind.
> 
> LGTM!
> 
> Are you planning to update the service as well?
I'm not sure if updating the service is a good idea.  On the upside,
people who report mpd starting too early will be alleviated of one
issue.  On the downside, it appears as though mpd too easily escapes
shepherd's management.  My current observations are more or less
consistent with what I saw with Emacs: killing the mpd service won't
stop playing music, and shepherd won't restart a killed MPD without
asked to.  IMHO shepherd's socket activation still needs some work
before we can make it the default for every service.

Cheers




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-04-17 21:57   ` Liliana Marie Prikler
@ 2022-04-18 21:05     ` Ludovic Courtès
  2022-04-18 21:19       ` Liliana Marie Prikler
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2022-04-18 21:05 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986

Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> I'm not sure if updating the service is a good idea.  On the upside,
> people who report mpd starting too early will be alleviated of one
> issue.  On the downside, it appears as though mpd too easily escapes
> shepherd's management.  My current observations are more or less
> consistent with what I saw with Emacs: killing the mpd service won't
> stop playing music,

Do you mean that ‘herd stop mpd’ doesn’t stop the mpd process?

What does /var/log/messages say?

> and shepherd won't restart a killed MPD without asked to.

Weird.  What you describe sounds as if shepherd is not looking at the
right process or something.

If you have a service definition to reproduce this, I’d be happy to take
a look!

Thanks,
Ludo’.




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-04-18 21:05     ` Ludovic Courtès
@ 2022-04-18 21:19       ` Liliana Marie Prikler
  2022-04-27 20:56         ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-18 21:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54986

Am Montag, dem 18.04.2022 um 23:05 +0200 schrieb Ludovic Courtès:
> Hi,
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:
> 
> > I'm not sure if updating the service is a good idea.  On the
> > upside, people who report mpd starting too early will be alleviated
> > of one issue.  On the downside, it appears as though mpd too easily
> > escapes shepherd's management.  My current observations are more or
> > less consistent with what I saw with Emacs: killing the mpd service
> > won't stop playing music,
> 
> Do you mean that ‘herd stop mpd’ doesn’t stop the mpd process?
Yep.
> What does /var/log/messages say?
I don't think there's anything meaningful there to inspect, I'm running
this as a user service.  Shepherd's own logs are rather empty.

Interestingly, the running value for the mpd service remains
(("unknown" . "#<input-output: socket 17>")) even after MPD started. 
Should that be the case?

> > and shepherd won't restart a killed MPD without asked to.
> 
> Weird.  What you describe sounds as if shepherd is not looking at the
> right process or something.
> 
> If you have a service definition to reproduce this, I’d be happy to
> take a look!
The second is probably just me forgetting to set #:respawn? #t.  One
"bug" down, one more to go.




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

* [bug#54986] [PATCH v2 2/3 WIP] services: shepherd: Add support for socket activation endpoints.
  2022-04-17 10:01 [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Liliana Marie Prikler
  2022-04-17 10:01 ` [bug#54986] [PATCH v2 1/3] " Liliana Marie Prikler
  2022-04-17 21:06 ` [bug#54986] [PATCH] " Ludovic Courtès
@ 2022-04-23 14:25 ` Liliana Marie Prikler
  2022-04-27 22:05   ` Ludovic Courtès
  2022-04-23 14:25 ` [bug#54986] [PATCH v3 1/2] " Liliana Marie Prikler
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-23 14:25 UTC (permalink / raw)
  To: 54986; +Cc: ludo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4532 bytes --]

* gnu/services/shepherd.scm (<shepherd-endpoint>): New record type.
(shepherd-endpoint->sexp): New variable.
* doc/guix.texi (Shepherd Services): Document it.
---
 doc/guix.texi             | 29 +++++++++++++++++++
 gnu/services/shepherd.scm | 60 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5399584cb0..38aeda1d2d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37675,6 +37675,35 @@ This, as you can see, is a fairly sophisticated way to say hello.
 info on actions.
 @end deftp
 
+@deftp {Data Type} shepherd-endpoint
+This is an endpoint that a systemd-style shepherd service listens on.
+
+@table @code
+@item address
+This is the socket address that shepherd binds and forwards to the service.
+
+@item name
+‾\_(ツ)_/‾
+
+@item style
+‾\_(ツ)_/‾
+
+@item backlog
+‾\_(ツ)_/‾
+
+@item socket-owner
+This is the user ID owning the socket.
+
+@item socket-group
+This is the group ID owning the socket.
+
+@item socket-directory-permissions
+These are the UNIX permissions to set for the directory the socket
+resides in.
+
+@end table
+@end deftp
+
 @defvr {Scheme Variable} shepherd-root-service-type
 The service type for the Shepherd ``root service''---i.e., PID@tie{}1.
 
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 4fd4b2a497..3ef0023d7f 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -66,6 +66,16 @@ (define-module (gnu services shepherd)
             shepherd-action-documentation
             shepherd-action-procedure
 
+            shepherd-endpoint
+            shepherd-endpoint-address
+            shepherd-endpoint-name
+            shepherd-endpoint-style
+            shepherd-endpoint-backlog
+            shepherd-endpoint-socket-owner
+            shepherd-endpoint-socket-group
+            shepherd-endpoint-socket-directory-permissions
+            shepherd-endpoint->sexp
+
             %default-modules
 
             shepherd-service-file
@@ -183,6 +193,56 @@ (define %default-modules
     ((guix build utils) #:hide (delete))
     (guix build syscalls)))
 
+(define-record-type* <shepherd-endpoint>
+  shepherd-endpoint make-shepherd-endpoint
+  shepherd-endpoint?
+  (address                      shepherd-endpoint-address)      ; sockaddr
+  (name                         shepherd-endpoint-name          ; string | #f
+                                (default #f))
+  (style                        shepherd-endpoint-style         ; int | #f
+                                (default #f))
+  (backlog                      shepherd-endpoint-backlog       ; int | #f
+                                (default #f))
+  (socket-owner                 shepherd-endpoint-socket-owner  ; uid | #f
+                                (default #f))
+  (socket-group                 shepherd-endpoint-socket-group  ; gid | #f
+                                (default #f))
+  (socket-directory-permissions
+   shepherd-endpoint-socket-directory-permissions ; chmod pattern (int) | #f
+   (default #f)))
+
+(define (shepherd-endpoint->sexp endpoint)
+  (match endpoint
+    (($ <shepherd-endpoint> address
+                            name style backlog socket-owner socket-group
+                            socket-directory-permissions)
+     `(endpoint
+       ,(match (sockaddr:fam address)
+          ((? (cute = <> AF_INET) _)
+           `(make-socket-addr AF_INET
+                              ,(sockaddr:addr address)
+                              ,(sockaddr:port address)))
+          ((? (cute = <> AF_INET6) _)
+           `(make-socket-addr AF_INET6
+                              ,(sockaddr:addr address)
+                              ,(sockaddr:port address)
+                              ,(sockaddr:flowinfo address)
+                              ,(sockaddr:scopeid address)))
+          ((? (cute = <> AF_UNIX) _)
+           `(make-socket-addr AF_UNIX
+                              ,(sockaddr:path address))))
+       ,@(fold
+          (match-lambda*
+            (((key value) seed)
+             (if value (cons* key value seed) seed)))
+          '()
+          `((#:name ,name)
+            (#:style ,style)
+            (#:backlog ,backlog)
+            (#:socket-owner ,socket-owner)
+            (#:socket-group ,socket-group)
+            (#:socket-directory-permissions ,socket-directory-permissions)))))))
+
 (define-record-type* <shepherd-service>
   shepherd-service make-shepherd-service
   shepherd-service?
-- 
2.35.1





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

* [bug#54986] [PATCH v3 1/2] services: shepherd: Add support for socket activation endpoints.
  2022-04-17 10:01 [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Liliana Marie Prikler
                   ` (2 preceding siblings ...)
  2022-04-23 14:25 ` [bug#54986] [PATCH v2 2/3 WIP] services: shepherd: Add support for socket activation endpoints Liliana Marie Prikler
@ 2022-04-23 14:25 ` Liliana Marie Prikler
  2023-04-26  0:33   ` [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Maxim Cournoyer
  2022-04-23 14:39 ` [bug#54986] [PATCH v3 2/2] services: mpd: Support " Liliana Marie Prikler
  2022-04-23 14:39 ` [bug#54986] [PATCH v2 3/3 WIP] " Liliana Marie Prikler
  5 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-23 14:25 UTC (permalink / raw)
  To: 54986; +Cc: Ludovic Courtès, Maxime Devos

* gnu/services/shepherd.scm (<shepherd-endpoint>): New record type.
(shepherd-endpoint->sexp): New variable.
* doc/guix.texi (Shepherd Services): Document it.
---
 doc/guix.texi             | 32 ++++++++++++++++++++
 gnu/services/shepherd.scm | 64 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index c21235f28d..30cc3b6d45 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -39332,6 +39332,38 @@ This, as you can see, is a fairly sophisticated way to say hello.
 info on actions.
 @end deftp
 
+@deftp {Data Type} shepherd-endpoint
+This data type represents an endpoint for inetd-style and systemd-style
+services.  Its fields reflect the arguments to shepherd's
+@code{endpoint} procedure.
+
+@table @code
+@item address
+The socket address to bind via shepherd and forward to the service.
+
+@item name
+A ``descriptive'' name to forward to the service along with the socket.
+
+@item style
+The socket style to use.
+@xref{Network Sockets and Communication,,, guile, GNU Guile Reference
+Manual}.
+
+@item backlog
+The maximum length of the queue for pending connections.
+
+@item socket-owner
+The user ID owning the socket.
+
+@item socket-group
+The group ID owning the socket.
+
+@item socket-directory-permissions
+The UNIX permissions to set for the directory the socket resides in.
+
+@end table
+@end deftp
+
 @defvr {Scheme Variable} shepherd-root-service-type
 The service type for the Shepherd ``root service''---i.e., PID@tie{}1.
 
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 4fd4b2a497..f0d204ff3a 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -66,6 +66,17 @@ (define-module (gnu services shepherd)
             shepherd-action-documentation
             shepherd-action-procedure
 
+            shepherd-endpoint
+            shepherd-endpoint?
+            shepherd-endpoint-address
+            shepherd-endpoint-name
+            shepherd-endpoint-style
+            shepherd-endpoint-backlog
+            shepherd-endpoint-socket-owner
+            shepherd-endpoint-socket-group
+            shepherd-endpoint-socket-directory-permissions
+            shepherd-endpoint->sexp
+
             %default-modules
 
             shepherd-service-file
@@ -183,6 +194,59 @@ (define %default-modules
     ((guix build utils) #:hide (delete))
     (guix build syscalls)))
 
+(define-record-type* <shepherd-endpoint>
+  shepherd-endpoint make-shepherd-endpoint
+  shepherd-endpoint?
+  (address                      shepherd-endpoint-address)      ; sockaddr
+  (name                         shepherd-endpoint-name          ; string | #f
+                                (default #f))
+  (style                        shepherd-endpoint-style         ; int | #f
+                                (default #f))
+  (backlog                      shepherd-endpoint-backlog       ; int | #f
+                                (default #f))
+  (socket-owner                 shepherd-endpoint-socket-owner  ; uid | #f
+                                (default #f))
+  (socket-group                 shepherd-endpoint-socket-group  ; gid | #f
+                                (default #f))
+  (socket-directory-permissions
+   shepherd-endpoint-socket-directory-permissions ; chmod pattern (int) | #f
+   (default #f)))
+
+(define (shepherd-endpoint->sexp endpoint)
+  (match endpoint
+    (($ <shepherd-endpoint> address
+                            name style backlog socket-owner socket-group
+                            socket-directory-permissions)
+     `(endpoint
+       ,(match (sockaddr:fam address)
+          ((? (cute = <> AF_INET) _)
+           `((@ (guile) make-socket-addr)
+             AF_INET
+             ,(sockaddr:addr address)
+             ,(sockaddr:port address)))
+          ((? (cute = <> AF_INET6) _)
+           `((@ (guile) make-socket-addr)
+             AF_INET6
+             ,(sockaddr:addr address)
+             ,(sockaddr:port address)
+             ,(sockaddr:flowinfo address)
+             ,(sockaddr:scopeid address)))
+          ((? (cute = <> AF_UNIX) _)
+           `((@ (guile) make-socket-addr)
+             AF_UNIX
+             ,(sockaddr:path address))))
+       ,@(fold
+          (match-lambda*
+            (((key value) seed)
+             (if value (cons* key value seed) seed)))
+          '()
+          `((#:name ,name)
+            (#:style ,style)
+            (#:backlog ,backlog)
+            (#:socket-owner ,socket-owner)
+            (#:socket-group ,socket-group)
+            (#:socket-directory-permissions ,socket-directory-permissions)))))))
+
 (define-record-type* <shepherd-service>
   shepherd-service make-shepherd-service
   shepherd-service?
-- 
2.37.3





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

* [bug#54986] [PATCH v2 3/3 WIP] services: mpd: Support socket activation.
  2022-04-17 10:01 [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Liliana Marie Prikler
                   ` (4 preceding siblings ...)
  2022-04-23 14:39 ` [bug#54986] [PATCH v3 2/2] services: mpd: Support " Liliana Marie Prikler
@ 2022-04-23 14:39 ` Liliana Marie Prikler
  2022-04-23 17:31   ` Maxime Devos
                     ` (2 more replies)
  5 siblings, 3 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-23 14:39 UTC (permalink / raw)
  To: 54986; +Cc: ludo

* gnu/services/audio.scm (<mpd-configuration>)[shepherd-endpoints]: New field.
(mpd-shepherd-service): Use it.
* doc/guix.texi (Music Player Daemon): Document it.
---
 doc/guix.texi          |  7 +++++++
 gnu/services/audio.scm | 45 ++++++++++++++++++++++++++++++------------
 2 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 38aeda1d2d..6bfa854b1d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -30883,6 +30883,13 @@ The port to run mpd on.
 The address that mpd will bind to.  To use a Unix domain socket,
 an absolute path can be specified here.
 
+@item @code{shepherd-endpoints} (default: @code{'()})
+The endpoints shepherd shall bind and spawn MPD from.  If this field is
+not empty (checked via @code{null?}), a systemd-style service is used
+rather than a forkexec-service.  This delays the start of MPD until the
+first client connects.  As a side effect @code{port} and @code{address}
+may be ignored.
+
 @item @code{outputs} (default: @code{"(list (mpd-output))"})
 The audio outputs that MPD can use.  By default this is a single output using pulseaudio.
 
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
index c60053f33c..b184ac596a 100644
--- a/gnu/services/audio.scm
+++ b/gnu/services/audio.scm
@@ -78,6 +78,8 @@ (define-record-type* <mpd-configuration>
                 (default "6600"))
   (address      mpd-configuration-address
                 (default "any"))
+  (shepherd-endpoints mpd-configuration-shepherd-endpoints
+                      (default '())) ; list of <shepherd-endpoint>
   (outputs      mpd-configuration-outputs
                 (default (list (mpd-output)))))
 
@@ -140,19 +142,36 @@ (define (mpd-shepherd-service config)
    (documentation "Run the MPD (Music Player Daemon)")
    (requirement '(user-processes))
    (provision '(mpd))
-   (start #~(make-forkexec-constructor
-             (list #$(file-append mpd "/bin/mpd")
-                   "--no-daemon"
-                   #$(mpd-config->file config))
-             #:environment-variables
-             ;; Required to detect PulseAudio when run under a user account.
-             (list (string-append
-                    "XDG_RUNTIME_DIR=/run/user/"
-                    (number->string
-                     (passwd:uid
-                      (getpwnam #$(mpd-configuration-user config))))))
-             #:log-file #$(mpd-file-name config "log")))
-   (stop  #~(make-kill-destructor))))
+   (start (if (null? (mpd-configuration-shepherd-endpoints config))
+              #~(make-forkexec-constructor
+                 (list #$(file-append mpd "/bin/mpd")
+                       "--no-daemon"
+                       #$(mpd-config->file config))
+                 #:environment-variables
+                 ;; Required to detect PulseAudio when run under a user account.
+                 (list (string-append
+                        "XDG_RUNTIME_DIR=/run/user/"
+                        (number->string
+                         (passwd:uid
+                          (getpwnam #$(mpd-configuration-user config))))))
+                 #:log-file #$(mpd-file-name config "log"))
+              #~(make-systemd-constructor
+                 (list #$(file-append mpd "/bin/mpd")
+                       "--systemd"
+                       #$(mpd-config->file config))
+                 (list #$@(map shepherd-endpoint->sexp
+                               (mpd-configuration-shepherd-endpoints config)))
+                 #:environment-variables
+                 ;; Required to detect PulseAudio when run under a user account.
+                 (list (string-append
+                        "XDG_RUNTIME_DIR=/run/user/"
+                        (number->string
+                         (passwd:uid
+                          (getpwnam #$(mpd-configuration-user config))))))
+                 #:log-file #$(mpd-file-name config "log"))))
+   (stop  (if (null? (mpd-configuration-shepherd-endpoints config))
+              #~(make-kill-destructor)
+              #~(make-systemd-destructor)))))
 
 (define (mpd-service-activation config)
   (with-imported-modules '((guix build utils))
-- 
2.35.1





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

* [bug#54986] [PATCH v3 2/2] services: mpd: Support socket activation.
  2022-04-17 10:01 [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Liliana Marie Prikler
                   ` (3 preceding siblings ...)
  2022-04-23 14:25 ` [bug#54986] [PATCH v3 1/2] " Liliana Marie Prikler
@ 2022-04-23 14:39 ` Liliana Marie Prikler
  2022-10-23 11:38   ` Liliana Marie Prikler
  2022-04-23 14:39 ` [bug#54986] [PATCH v2 3/3 WIP] " Liliana Marie Prikler
  5 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-23 14:39 UTC (permalink / raw)
  To: 54986; +Cc: Ludovic Courtès, Maxime Devos

* gnu/services/audio.scm (<mpd-endpoint>): New record.
(<mpd-configuration>)[port, address]: Removed fields.
[endpoints]: New field.
(sanitize-mpd-endpoints, mpd-configuration-shepherd-endpoints): New variables.
(mpd-shepherd-service): Use mpd-configuration-shepherd-endpoints.
* doc/guix.texi (Music Player Daemon): Document it.
---
 doc/guix.texi          | 23 ++++++++--
 gnu/services/audio.scm | 98 +++++++++++++++++++++++++++++++++---------
 2 files changed, 97 insertions(+), 24 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 30cc3b6d45..d5b9de0de2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32192,15 +32192,30 @@ The location of the file that stores current MPD's state.
 @item @code{sticker-file} (default: @code{"~/.mpd/sticker.sql"})
 The location of the sticker database.
 
-@item @code{port} (default: @code{"6600"})
-The port to run mpd on.
+@item @code{endpoints} (default: @code{(list (mpd-endpoint))})
+The endpoints to bind MPD to.  This can be an mpd-endpoint (see below)
+or a list of shepherd endpoints.  If using shepherd endpoints, MPD
+will be spawned as a systemd-style service rather than as a
+forkexec-style one.  This delays the start of MPD until the first client
+connects.
+
+@item @code{outputs} (default: @code{"(list (mpd-output))"})
+The audio outputs that MPD can use.  By default this is a single output using pulseaudio.
+
+@end table
+@end deftp
+
+@deftp {Data Type} mpd-endpoint
+Data type representing the configuration of @command{mpd}.
+
+@table @asis
 
 @item @code{address} (default: @code{"any"})
 The address that mpd will bind to.  To use a Unix domain socket,
 an absolute path can be specified here.
 
-@item @code{outputs} (default: @code{"(list (mpd-output))"})
-The audio outputs that MPD can use.  By default this is a single output using pulseaudio.
+@item @code{port} (default: @code{"6600"})
+The port to run mpd on.
 
 @end table
 @end deftp
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
index c60053f33c..6e8fd460a1 100644
--- a/gnu/services/audio.scm
+++ b/gnu/services/audio.scm
@@ -20,6 +20,8 @@
 
 (define-module (gnu services audio)
   #:use-module (guix gexp)
+  #:use-module (guix diagnostics)
+  #:use-module (guix i18n)
   #:use-module (gnu services)
   #:use-module (gnu services shepherd)
   #:use-module (gnu system shadow)
@@ -28,8 +30,14 @@ (define-module (gnu services audio)
   #:use-module (guix records)
   #:use-module (ice-9 match)
   #:use-module (ice-9 format)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:export (mpd-output
             mpd-output?
+            mpd-endpoint
+            mpd-endpoint?
             mpd-configuration
             mpd-configuration?
             mpd-service-type))
@@ -59,6 +67,30 @@ (define-record-type* <mpd-output>
   (extra-options mpd-output-extra-options
                  (default '())))
 
+(define-record-type* <mpd-endpoint>
+  mpd-endpoint make-mpd-endpoint
+  mpd-endpoint?
+  (address mpd-endpoint-address (default "any"))
+  (port    mpd-endpoint-port (default "6600")))
+
+(define-with-syntax-properties (sanitize-mpd-endpoints (endpoints properties))
+  (match endpoints
+    ((? mpd-endpoint? endpoint) (list endpoint))
+    (((? mpd-endpoint?)) endpoints)
+    (((? mpd-endpoint?) . _)
+     (raise (make-compound-condition
+             (condition (&message
+                         (message
+                          (G_ "\
+<mpd-endpoint> is mutually exclusive with other endpoints."))))
+             (condition (&error-location
+                         (location (source-properties->location properties))))
+             (condition (&fix-hint
+                         (hint "\
+Make sure you only need one endpoint or use shepherd endpoints instead."))))))
+    (((? shepherd-endpoint?) . (? (cute every shepherd-endpoint? <>)))
+     endpoints)))
+
 (define-record-type* <mpd-configuration>
   mpd-configuration make-mpd-configuration
   mpd-configuration?
@@ -74,10 +106,9 @@ (define-record-type* <mpd-configuration>
                 (default "~/.mpd/state"))
   (sticker-file mpd-configuration-sticker-file
                 (default "~/.mpd/sticker.sql"))
-  (port         mpd-configuration-port
-                (default "6600"))
-  (address      mpd-configuration-address
-                (default "any"))
+  (endpoints    mpd-configuration-endpoints     ; list of <shepherd-endpoint>
+                (default (list (mpd-endpoint))) ;       | <mpd-endpoint>
+                (sanitize sanitize-mpd-endpoints))
   (outputs      mpd-configuration-outputs
                 (default (list (mpd-output)))))
 
@@ -124,9 +155,12 @@ (define (mpd-config->file config)
                   ("playlist_directory" ,mpd-configuration-playlist-dir)
                   ("db_file" ,mpd-configuration-db-file)
                   ("state_file" ,mpd-configuration-state-file)
-                  ("sticker_file" ,mpd-configuration-sticker-file)
-                  ("port" ,mpd-configuration-port)
-                  ("bind_to_address" ,mpd-configuration-address))))))
+                  ("sticker_file" ,mpd-configuration-sticker-file)))
+           (match (mpd-configuration-endpoints config)
+             (($ <mpd-endpoint> address port)
+              `(("bind_to_address" ,address)
+                ("port" ,port)))
+             (_ '())))))
 
 (define (mpd-file-name config file)
   "Return a path in /var/run/mpd/ that is writable
@@ -135,24 +169,48 @@ (define (mpd-file-name config file)
                  (mpd-configuration-user config)
                  "/" file))
 
+(define (mpd-configuration-shepherd-endpoints config)
+  "Return @code{(mpd-configuration-endpoints config)}"
+  (let ((endpoints (mpd-configuration-endpoints config)))
+    (match endpoints
+      (((? shepherd-endpoint?) . _) endpoints)
+      (_ #f))))
+
 (define (mpd-shepherd-service config)
   (shepherd-service
    (documentation "Run the MPD (Music Player Daemon)")
    (requirement '(user-processes))
    (provision '(mpd))
-   (start #~(make-forkexec-constructor
-             (list #$(file-append mpd "/bin/mpd")
-                   "--no-daemon"
-                   #$(mpd-config->file config))
-             #:environment-variables
-             ;; Required to detect PulseAudio when run under a user account.
-             (list (string-append
-                    "XDG_RUNTIME_DIR=/run/user/"
-                    (number->string
-                     (passwd:uid
-                      (getpwnam #$(mpd-configuration-user config))))))
-             #:log-file #$(mpd-file-name config "log")))
-   (stop  #~(make-kill-destructor))))
+   (start (if (mpd-configuration-shepherd-endpoints config)
+              #~(make-systemd-constructor
+                 (list #$(file-append mpd "/bin/mpd")
+                       "--systemd"
+                       #$(mpd-config->file config))
+                 (list #$@(map shepherd-endpoint->sexp
+                               (mpd-configuration-shepherd-endpoints config)))
+                 #:environment-variables
+                 ;; Required to detect PulseAudio when run under a user account.
+                 (list (string-append
+                        "XDG_RUNTIME_DIR=/run/user/"
+                        (number->string
+                         (passwd:uid
+                          (getpwnam #$(mpd-configuration-user config))))))
+                 #:log-file #$(mpd-file-name config "log"))
+              #~(make-forkexec-constructor
+                 (list #$(file-append mpd "/bin/mpd")
+                       "--no-daemon"
+                       #$(mpd-config->file config))
+                 #:environment-variables
+                 ;; Required to detect PulseAudio when run under a user account.
+                 (list (string-append
+                        "XDG_RUNTIME_DIR=/run/user/"
+                        (number->string
+                         (passwd:uid
+                          (getpwnam #$(mpd-configuration-user config))))))
+                 #:log-file #$(mpd-file-name config "log"))))
+   (stop  (if (mpd-configuration-shepherd-endpoints config)
+              #~(make-systemd-destructor)
+              #~(make-kill-destructor)))))
 
 (define (mpd-service-activation config)
   (with-imported-modules '((guix build utils))
-- 
2.37.3





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

* [bug#54986] [PATCH v2 3/3 WIP] services: mpd: Support socket activation.
  2022-04-23 14:39 ` [bug#54986] [PATCH v2 3/3 WIP] " Liliana Marie Prikler
@ 2022-04-23 17:31   ` Maxime Devos
  2022-04-23 18:36     ` Liliana Marie Prikler
  2022-04-23 17:35   ` Maxime Devos
  2022-04-27 22:08   ` Ludovic Courtès
  2 siblings, 1 reply; 32+ messages in thread
From: Maxime Devos @ 2022-04-23 17:31 UTC (permalink / raw)
  To: Liliana Marie Prikler, 54986; +Cc: ludo

[-- Attachment #1: Type: text/plain, Size: 1367 bytes --]

> +(define (shepherd-endpoint->sexp endpoint)
> +  (match endpoint
> +    (($ <shepherd-endpoint> address
> +                            name style backlog socket-owner socket-
group
> +                            socket-directory-permissions)
> +     `(endpoint
> +       ,(match (sockaddr:fam address)
> +          ((? (cute = <> AF_INET) _)
> +           `(make-socket-addr AF_INET
> +                              ,(sockaddr:addr address)
> +                              ,(sockaddr:port address)))

Liliana Marie Prikler schreef op za 23-04-2022 om 16:39 [+0200]:
> +                 (list #$@(map shepherd-endpoint->sexp
> +                               (mpd-configuration-shepherd-endpoints config))) 

For hygiene reasons, should 'shepherd-endpoint->sexp' use @?

  `((@ (the module) endpoint)
    ,(match [...]
        ((@ [...] make-socket-addr (@ [...] AF_UNIX) ...)
        ...))

That way, no assumptions are made on what modules are imported and it
avoids hygiene problems like in

  ;; There are two ‘endpoints’ here: the ‘API endpoint’,
  ;; and Shepherd endpoints.
  #~(let ((endpoint "http://localhost:1234/api"))
      (make-systemd-constructor
         (list #$(file-append soft "/bin/ware")
               "--endpoint" #$endpoint)
         (list (shepherd-endpoint->sexp ...))))

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54986] [PATCH v2 3/3 WIP] services: mpd: Support socket activation.
  2022-04-23 14:39 ` [bug#54986] [PATCH v2 3/3 WIP] " Liliana Marie Prikler
  2022-04-23 17:31   ` Maxime Devos
@ 2022-04-23 17:35   ` Maxime Devos
  2022-04-23 18:28     ` Liliana Marie Prikler
  2022-04-27 22:08   ` Ludovic Courtès
  2 siblings, 1 reply; 32+ messages in thread
From: Maxime Devos @ 2022-04-23 17:35 UTC (permalink / raw)
  To: Liliana Marie Prikler, 54986; +Cc: ludo

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

Liliana Marie Prikler schreef op za 23-04-2022 om 16:39 [+0200]:
> +@item @code{shepherd-endpoints} (default: @code{'()})
> +The endpoints shepherd shall bind and spawn MPD from.  If this field is
> +not empty (checked via @code{null?}), a systemd-style service is used
> +rather than a forkexec-service.

systemd-style / forkexec-service looks like an implementation detail to
me, not something useful to the user.

>  This delays the start of MPD until the
> +first client connects.
> 

Likewise.

>   As a side effect @code{port} and @code{address}
> +may be ignored.

Could these three fields be unified, keeping 'port' and 'address' only
for some backwards compatibility?  E.g.:

  (mpd-configuration
    (endpoints (list (shepherd-endpoint [a AF_INET6 address])
                     (shepherd-endpoint [a AF_UNIX address]))))

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54986] [PATCH v2 3/3 WIP] services: mpd: Support socket activation.
  2022-04-23 17:35   ` Maxime Devos
@ 2022-04-23 18:28     ` Liliana Marie Prikler
  0 siblings, 0 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-23 18:28 UTC (permalink / raw)
  To: Maxime Devos, 54986; +Cc: ludo

Am Samstag, dem 23.04.2022 um 19:35 +0200 schrieb Maxime Devos:
> Liliana Marie Prikler schreef op za 23-04-2022 om 16:39 [+0200]:
> > +@item @code{shepherd-endpoints} (default: @code{'()})
> > +The endpoints shepherd shall bind and spawn MPD from.  If this
> > field is
> > +not empty (checked via @code{null?}), a systemd-style service is
> > used
> > +rather than a forkexec-service.
> 
> systemd-style / forkexec-service looks like an implementation detail
> to me, not something useful to the user.
> 
> >  This delays the start of MPD until the
> > +first client connects.
> 
> Likewise.
Even if this was just an implementation detail, I shall point to
Hyrum's law.

> >   As a side effect @code{port} and @code{address}
> > +may be ignored.
> 
> Could these three fields be unified, keeping 'port' and 'address'
> only for some backwards compatibility?  E.g.:
> 
>   (mpd-configuration
>     (endpoints (list (shepherd-endpoint [a AF_INET6 address])
>                      (shepherd-endpoint [a AF_UNIX address]))))
Not AFAIK.  MPD is less strict than Guile when it comes to addresses,
so converting from address+port to socket addresses is nontrivial. 
That being said, I'm not sure if they are even ignored.  MPD only warns
about pid_file, so they might also be used.

Cheers




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

* [bug#54986] [PATCH v2 3/3 WIP] services: mpd: Support socket activation.
  2022-04-23 17:31   ` Maxime Devos
@ 2022-04-23 18:36     ` Liliana Marie Prikler
  0 siblings, 0 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-23 18:36 UTC (permalink / raw)
  To: Maxime Devos, 54986; +Cc: ludo

Am Samstag, dem 23.04.2022 um 19:31 +0200 schrieb Maxime Devos:
> > +(define (shepherd-endpoint->sexp endpoint)
> > +  (match endpoint
> > +    (($ <shepherd-endpoint> address
> > +                            name style backlog socket-owner
> > socket-
> group
> > +                            socket-directory-permissions)
> > +     `(endpoint
> > +       ,(match (sockaddr:fam address)
> > +          ((? (cute = <> AF_INET) _)
> > +           `(make-socket-addr AF_INET
> > +                              ,(sockaddr:addr address)
> > +                              ,(sockaddr:port address)))
> 
> Liliana Marie Prikler schreef op za 23-04-2022 om 16:39 [+0200]:
> > +                 (list #$@(map shepherd-endpoint->sexp
> > +                               (mpd-configuration-shepherd-
> > endpoints config))) 
> 
> For hygiene reasons, should 'shepherd-endpoint->sexp' use @?
> 
>   `((@ (the module) endpoint)
>     ,(match [...]
>         ((@ [...] make-socket-addr (@ [...] AF_UNIX) ...)
>         ...))
> 
> That way, no assumptions are made on what modules are imported and it
> avoids hygiene problems like in
> 
>   ;; There are two ‘endpoints’ here: the ‘API endpoint’,
>   ;; and Shepherd endpoints.
>   #~(let ((endpoint "http://localhost:1234/api"))
>       (make-systemd-constructor
>          (list #$(file-append soft "/bin/ware")
>                "--endpoint" #$endpoint)
>          (list (shepherd-endpoint->sexp ...))))
Good point, that's should probably done for defensive programming. 
Note also that I'm missing half of the documentation still, so it won't
be pushed too soon, though.




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-04-18 21:19       ` Liliana Marie Prikler
@ 2022-04-27 20:56         ` Ludovic Courtès
  2022-04-28 16:45           ` Liliana Marie Prikler
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2022-04-27 20:56 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986

Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

[...]

>> Do you mean that ‘herd stop mpd’ doesn’t stop the mpd process?
> Yep.
>> What does /var/log/messages say?
> I don't think there's anything meaningful there to inspect, I'm running
> this as a user service.  Shepherd's own logs are rather empty.

Then it’s in ~/.local/state (by default) or
~/.local/var/log/shepherd.log if you’re using Guix Home.

> Interestingly, the running value for the mpd service remains
> (("unknown" . "#<input-output: socket 17>")) even after MPD started. 
> Should that be the case?

No.

>> > and shepherd won't restart a killed MPD without asked to.
>> 
>> Weird.  What you describe sounds as if shepherd is not looking at the
>> right process or something.
>> 
>> If you have a service definition to reproduce this, I’d be happy to
>> take a look!
> The second is probably just me forgetting to set #:respawn? #t.  One
> "bug" down, one more to go.

:-)

Ludo’.




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

* [bug#54986] [PATCH v2 2/3 WIP] services: shepherd: Add support for socket activation endpoints.
  2022-04-23 14:25 ` [bug#54986] [PATCH v2 2/3 WIP] services: shepherd: Add support for socket activation endpoints Liliana Marie Prikler
@ 2022-04-27 22:05   ` Ludovic Courtès
  0 siblings, 0 replies; 32+ messages in thread
From: Ludovic Courtès @ 2022-04-27 22:05 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986

Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> * gnu/services/shepherd.scm (<shepherd-endpoint>): New record type.
> (shepherd-endpoint->sexp): New variable.
> * doc/guix.texi (Shepherd Services): Document it.

[...]

> +++ b/gnu/services/shepherd.scm
> @@ -66,6 +66,16 @@ (define-module (gnu services shepherd)
>              shepherd-action-documentation
>              shepherd-action-procedure
>  
> +            shepherd-endpoint
> +            shepherd-endpoint-address
> +            shepherd-endpoint-name
> +            shepherd-endpoint-style
> +            shepherd-endpoint-backlog
> +            shepherd-endpoint-socket-owner
> +            shepherd-endpoint-socket-group
> +            shepherd-endpoint-socket-directory-permissions
> +            shepherd-endpoint->sexp
> +
>              %default-modules
>  
>              shepherd-service-file
> @@ -183,6 +193,56 @@ (define %default-modules
>      ((guix build utils) #:hide (delete))
>      (guix build syscalls)))
>  
> +(define-record-type* <shepherd-endpoint>

I don’t think this is necessary: Shepherd endpoints are created in a
#~(make-systemd-constructor …) gexp, it’s OK to use the Shepherd
endpoint API there.

Ludo’.




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

* [bug#54986] [PATCH v2 3/3 WIP] services: mpd: Support socket activation.
  2022-04-23 14:39 ` [bug#54986] [PATCH v2 3/3 WIP] " Liliana Marie Prikler
  2022-04-23 17:31   ` Maxime Devos
  2022-04-23 17:35   ` Maxime Devos
@ 2022-04-27 22:08   ` Ludovic Courtès
  2022-05-13 15:55     ` [bug#54986] [PATCH] gnu: mpd: Add support for " Ludovic Courtès
  2 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2022-04-27 22:08 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986, Maxime Devos

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> * gnu/services/audio.scm (<mpd-configuration>)[shepherd-endpoints]: New field.
> (mpd-shepherd-service): Use it.
> * doc/guix.texi (Music Player Daemon): Document it.

[...]

> +++ b/gnu/services/audio.scm
> @@ -78,6 +78,8 @@ (define-record-type* <mpd-configuration>
>                  (default "6600"))
>    (address      mpd-configuration-address
>                  (default "any"))
> +  (shepherd-endpoints mpd-configuration-shepherd-endpoints
> +                      (default '())) ; list of <shepherd-endpoint>

The way I see it, service configuration should be oblivious to whether
it’s started as “forkexec”, systemd, or inetd.

There’s already an ‘address’ field above, so my suggestion would be to
reuse it.  This is what I did for example for the openssh service, and
also for bitlbee and dicod here:

  https://issues.guix.gnu.org/54997#5

WDYT?

Thanks,
Ludo’.




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-04-27 20:56         ` Ludovic Courtès
@ 2022-04-28 16:45           ` Liliana Marie Prikler
  0 siblings, 0 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-04-28 16:45 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54986

Am Mittwoch, dem 27.04.2022 um 22:56 +0200 schrieb Ludovic Courtès:
> 
> > Interestingly, the running value for the mpd service remains
> > (("unknown" . "#<input-output: socket 17>")) even after MPD
> > started. Should that be the case?
> 
> No.
It turns out the issue here was that I rewrote the service to put its
log into XDG_STATE_HOME as well, but under a directory that did not yet
exist.  #55080 addresses this.

Cheers




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-04-27 22:08   ` Ludovic Courtès
@ 2022-05-13 15:55     ` Ludovic Courtès
  2022-05-13 17:00       ` Liliana Marie Prikler
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2022-05-13 15:55 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986, Maxime Devos

Hi Liliana,

What’s the status of this patch series?  Would be nice to have it in!

Ludo’.

Ludovic Courtès <ludo@gnu.org> skribis:

> Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:
>
>> * gnu/services/audio.scm (<mpd-configuration>)[shepherd-endpoints]: New field.
>> (mpd-shepherd-service): Use it.
>> * doc/guix.texi (Music Player Daemon): Document it.
>
> [...]
>
>> +++ b/gnu/services/audio.scm
>> @@ -78,6 +78,8 @@ (define-record-type* <mpd-configuration>
>>                  (default "6600"))
>>    (address      mpd-configuration-address
>>                  (default "any"))
>> +  (shepherd-endpoints mpd-configuration-shepherd-endpoints
>> +                      (default '())) ; list of <shepherd-endpoint>
>
> The way I see it, service configuration should be oblivious to whether
> it’s started as “forkexec”, systemd, or inetd.
>
> There’s already an ‘address’ field above, so my suggestion would be to
> reuse it.  This is what I did for example for the openssh service, and
> also for bitlbee and dicod here:
>
>   https://issues.guix.gnu.org/54997#5
>
> WDYT?
>
> Thanks,
> Ludo’.




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-05-13 15:55     ` [bug#54986] [PATCH] gnu: mpd: Add support for " Ludovic Courtès
@ 2022-05-13 17:00       ` Liliana Marie Prikler
  0 siblings, 0 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-05-13 17:00 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54986, Maxime Devos

Am Freitag, dem 13.05.2022 um 17:55 +0200 schrieb Ludovic Courtès:
> Hi Liliana,
> 
> What’s the status of this patch series?  Would be nice to have it in!
The patch for MPD itself is good to go as far as I'm aware, the patch
for the service type is work in progress.

This question
> Ludovic Courtès <ludo@gnu.org> skribis:
> > The way I see it, service configuration should be oblivious to
> > whether it’s started as “forkexec”, systemd, or inetd.
has me in a bit of a bind in multiple ways.  For one, I don't see a
direct translation from MPD's configuration scheme to shepherd's.  For
another, the distinct semantics between forkexec and lazy loading cause
observable differences as in “What the fuck, I only ran mpc status, why
is the music now playing?” – this can be avoided if the user knows that
shepherd will be lazy-loading mpd and that it might as a result to
starting start playing on the first received command.

Moreover, I think the patch I added to make endpoint records
configurable from Guix could also serve to solve other bugs, e.g. SSH
only listening on IPv4 addresses, which would require us to be able to
specify whether to listen on IPv4, IPv6 or both through Guix.  Long
term, I think we should only keep the distinction between forkexec and
inetd/systemd for those services where it makes an observable
difference, like mpd.  For SSH, apart from bugs and perhaps people
using old shepherd, I don't think there'd be any reason to keep
forkexec beyond a certain point (in a future as distant as you would
want it to be).

Maxime also raised hygiene concerns that would be comparatively easy to
solve.

TL;DR: v2 [1/3] is good, [2/3 WIP] and [3/3 WIP] should be kept back
for now.

Cheers




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

* [bug#54986] [PATCH v3 2/2] services: mpd: Support socket activation.
  2022-04-23 14:39 ` [bug#54986] [PATCH v3 2/2] services: mpd: Support " Liliana Marie Prikler
@ 2022-10-23 11:38   ` Liliana Marie Prikler
  2022-11-26 12:59     ` Liliana Marie Prikler
  0 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-10-23 11:38 UTC (permalink / raw)
  To: 54986; +Cc: Ludovic Courtès, Maxime Devos

Am Samstag, dem 23.04.2022 um 16:39 +0200 schrieb Liliana Marie
Prikler:
> * gnu/services/audio.scm (<mpd-endpoint>): New record.
> (<mpd-configuration>)[port, address]: Removed fields.
> [endpoints]: New field.
> (sanitize-mpd-endpoints, mpd-configuration-shepherd-endpoints): New
> variables.
> (mpd-shepherd-service): Use mpd-configuration-shepherd-endpoints.
> * doc/guix.texi (Music Player Daemon): Document it.
> ---
Bump




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

* [bug#54986] [PATCH v3 2/2] services: mpd: Support socket activation.
  2022-10-23 11:38   ` Liliana Marie Prikler
@ 2022-11-26 12:59     ` Liliana Marie Prikler
  0 siblings, 0 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2022-11-26 12:59 UTC (permalink / raw)
  To: 54986; +Cc: Ludovic Courtès, Maxime Devos

Am Sonntag, dem 23.10.2022 um 13:38 +0200 schrieb Liliana Marie
Prikler:
> Am Samstag, dem 23.04.2022 um 16:39 +0200 schrieb Liliana Marie
> Prikler:
> > * gnu/services/audio.scm (<mpd-endpoint>): New record.
> > (<mpd-configuration>)[port, address]: Removed fields.
> > [endpoints]: New field.
> > (sanitize-mpd-endpoints, mpd-configuration-shepherd-endpoints): New
> > variables.
> > (mpd-shepherd-service): Use mpd-configuration-shepherd-endpoints.
> > * doc/guix.texi (Music Player Daemon): Document it.
> > ---
> Bump
Bumpy bump




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2022-04-23 14:25 ` [bug#54986] [PATCH v3 1/2] " Liliana Marie Prikler
@ 2023-04-26  0:33   ` Maxim Cournoyer
  2023-04-26  4:28     ` Liliana Marie Prikler
  0 siblings, 1 reply; 32+ messages in thread
From: Maxim Cournoyer @ 2023-04-26  0:33 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986, Ludovic Courtès, Maxime Devos

Hi!

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> * gnu/services/shepherd.scm (<shepherd-endpoint>): New record type.
> (shepherd-endpoint->sexp): New variable.
> * doc/guix.texi (Shepherd Services): Document it.

Like Ludovic, I'm wondering what duplicating the Shepherd endpoints API
in Guix buys us?  It sometimes feel a bit contrived to have to work
inside the service's gexp expression, but other than that, I think it's
good to:

1. Avoid duplication.
2. Keep it as internal/hidden as possible from users.

-- 
Thanks,
Maxim




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-04-26  0:33   ` [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Maxim Cournoyer
@ 2023-04-26  4:28     ` Liliana Marie Prikler
  2023-05-01 15:53       ` Maxim Cournoyer
  0 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2023-04-26  4:28 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 54986, Ludovic Courtès, Maxime Devos

Am Dienstag, dem 25.04.2023 um 20:33 -0400 schrieb Maxim Cournoyer:
> Hi!
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > * gnu/services/shepherd.scm (<shepherd-endpoint>): New record type.
> > (shepherd-endpoint->sexp): New variable.
> > * doc/guix.texi (Shepherd Services): Document it.
> 
> Like Ludovic, I'm wondering what duplicating the Shepherd endpoints
> API in Guix buys us?  It sometimes feel a bit contrived to have to
> work inside the service's gexp expression, but other than that, I
> think it's good to:
> 
> 1. Avoid duplication.
> 2. Keep it as internal/hidden as possible from users.
I agree with the point about avoiding duplication, but I want users to
be able to specify endpoints for socket activation.  This has several
benefits: It firstly allows users to specify that they want a specific
service to be started on demand rather than on boot, and it also allows
them to bind to multiple endpoints, e.g. any IPv4 address, any IPv6
address or both.  Duplicating the API here is merely a means of
allowing users to express the above in a Guixy fashion.  It also gives
us type-checking which a simple quote or quasiquote doesn't.  If the
same can be achieved by inspecting Shepherd's records and we can allow
Guix to depend on Shepherd, that'd be fine by me. 

Cheers




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-04-26  4:28     ` Liliana Marie Prikler
@ 2023-05-01 15:53       ` Maxim Cournoyer
  2023-05-01 16:09         ` Liliana Marie Prikler
  0 siblings, 1 reply; 32+ messages in thread
From: Maxim Cournoyer @ 2023-05-01 15:53 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986, Ludovic Courtès, Maxime Devos

Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Dienstag, dem 25.04.2023 um 20:33 -0400 schrieb Maxim Cournoyer:
>> Hi!
>> 
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>> 
>> > * gnu/services/shepherd.scm (<shepherd-endpoint>): New record type.
>> > (shepherd-endpoint->sexp): New variable.
>> > * doc/guix.texi (Shepherd Services): Document it.
>> 
>> Like Ludovic, I'm wondering what duplicating the Shepherd endpoints
>> API in Guix buys us?  It sometimes feel a bit contrived to have to
>> work inside the service's gexp expression, but other than that, I
>> think it's good to:
>> 
>> 1. Avoid duplication.
>> 2. Keep it as internal/hidden as possible from users.
> I agree with the point about avoiding duplication, but I want users to
> be able to specify endpoints for socket activation.  This has several
> benefits: It firstly allows users to specify that they want a specific
> service to be started on demand rather than on boot, and it also allows
> them to bind to multiple endpoints, e.g. any IPv4 address, any IPv6
> address or both.  Duplicating the API here is merely a means of
> allowing users to express the above in a Guixy fashion.  It also gives
> us type-checking which a simple quote or quasiquote doesn't.  If the
> same can be achieved by inspecting Shepherd's records and we can allow
> Guix to depend on Shepherd, that'd be fine by me. 

Instead of replicating the Shepherd API in Guix, could we use the
Shepherd API directly?  It's Scheme, and already depended on by Guix, so
the question arises.

It may not be a good idea, but I need to be refreshed on the reasons
:-).

-- 
Thanks,
Maxim




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-05-01 15:53       ` Maxim Cournoyer
@ 2023-05-01 16:09         ` Liliana Marie Prikler
  2023-05-03  3:17           ` Maxim Cournoyer
  2023-05-03 13:27           ` Ludovic Courtès
  0 siblings, 2 replies; 32+ messages in thread
From: Liliana Marie Prikler @ 2023-05-01 16:09 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 54986, Ludovic Courtès, Maxime Devos

Am Montag, dem 01.05.2023 um 11:53 -0400 schrieb Maxim Cournoyer:
> > > Like Ludovic, I'm wondering what duplicating the Shepherd
> > > endpoints API in Guix buys us?  [...]
> 
> Instead of replicating the Shepherd API in Guix, could we use the
> Shepherd API directly?  It's Scheme, and already depended on by Guix,
> so the question arises.
In theory, it'd be possible, albeit with some caveats:
1. Shepherd doesn't (didn't) have a full guix-style records API, which
might cause discrepancies in otherwise normal-looking Scheme code.
2. It'd probably make shepherd a compile-time dependency, which is
avoided in other places in the code, i.e. (gnu build shepherd)
3. Shepherd records are (to my knowledge) not print-readable, so we'd
have to move them through G-Expressions through some of our own code
anyway; how strongly that would replicate the API is up to
debate/speculation.

Cheers 




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-05-01 16:09         ` Liliana Marie Prikler
@ 2023-05-03  3:17           ` Maxim Cournoyer
  2023-05-03 13:27           ` Ludovic Courtès
  1 sibling, 0 replies; 32+ messages in thread
From: Maxim Cournoyer @ 2023-05-03  3:17 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986, Ludovic Courtès, Maxime Devos

Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Montag, dem 01.05.2023 um 11:53 -0400 schrieb Maxim Cournoyer:
>> > > Like Ludovic, I'm wondering what duplicating the Shepherd
>> > > endpoints API in Guix buys us?  [...]
>>
>> Instead of replicating the Shepherd API in Guix, could we use the
>> Shepherd API directly?  It's Scheme, and already depended on by Guix,
>> so the question arises.
> In theory, it'd be possible, albeit with some caveats:
> 1. Shepherd doesn't (didn't) have a full guix-style records API, which
> might cause discrepancies in otherwise normal-looking Scheme code.

Shepherd's code is pretty normal-looking Scheme code to me, last I
checked :-) I think Ludovic has also been working toward bringing it
closer to their standards, e.g. deprecating the use of GOOPS.

> 2. It'd probably make shepherd a compile-time dependency, which is
> avoided in other places in the code, i.e. (gnu build shepherd)

I wonder if that could be an acceptable price to pay?  It seems
reasonable to me that the close integration of Shepherd within Guix
introduces a dependency on it.

> 3. Shepherd records are (to my knowledge) not print-readable, so we'd
> have to move them through G-Expressions through some of our own code
> anyway; how strongly that would replicate the API is up to
> debate/speculation.

As far as I can tell, both are based on SRFI-9 records and use the same
representation, or I miss the fine details from the source.

-- 
Thanks,
Maxim




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-05-01 16:09         ` Liliana Marie Prikler
  2023-05-03  3:17           ` Maxim Cournoyer
@ 2023-05-03 13:27           ` Ludovic Courtès
  2023-05-03 16:54             ` Liliana Marie Prikler
  1 sibling, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2023-05-03 13:27 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986, Maxime Devos, Maxim Cournoyer

Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> Am Montag, dem 01.05.2023 um 11:53 -0400 schrieb Maxim Cournoyer:
>> > > Like Ludovic, I'm wondering what duplicating the Shepherd
>> > > endpoints API in Guix buys us?  [...]
>> 
>> Instead of replicating the Shepherd API in Guix, could we use the
>> Shepherd API directly?  It's Scheme, and already depended on by Guix,
>> so the question arises.
> In theory, it'd be possible, albeit with some caveats:

It’s not just possible: several services in (gnu services …) and (gnu
home services …) use endpoints for systemd or inetd-style startup.

> 1. Shepherd doesn't (didn't) have a full guix-style records API, which
> might cause discrepancies in otherwise normal-looking Scheme code.

I’m not convinced.  :-)

> 2. It'd probably make shepherd a compile-time dependency, which is
> avoided in other places in the code, i.e. (gnu build shepherd)

(gnu build shepherd) is 75% deprecated; the introduction of endpoints in
the Shepherd didn’t have any effect on it.

> 3. Shepherd records are (to my knowledge) not print-readable, so we'd
> have to move them through G-Expressions through some of our own code
> anyway; how strongly that would replicate the API is up to
> debate/speculation.

When would you want to print those <endpoint> records?

Thanks,
Ludo’.




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-05-03 13:27           ` Ludovic Courtès
@ 2023-05-03 16:54             ` Liliana Marie Prikler
  2023-05-10 15:14               ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2023-05-03 16:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54986, Maxime Devos, Maxim Cournoyer

Am Mittwoch, dem 03.05.2023 um 15:27 +0200 schrieb Ludovic Courtès:
> It’s not just possible: several services in (gnu services …) and (gnu
> home services …) use endpoints for systemd or inetd-style startup.
True, but to my knowledge they don't yet allow the user to specify
those endpoints directly.  At the very least, they didn't when I
started this thread, which was shortly after shepherd itself gained
endpoints.  I'm happy to be proven wrong on this point.

> > 1. Shepherd doesn't (didn't) have a full guix-style records API,
> > which might cause discrepancies in otherwise normal-looking Scheme
> > code.
> 
> I’m not convinced.  :-)
For more information, I'm a little worried that someone would attempt
  (endpoint (inherit some-other-endpoint) (field ...))
though perhaps that's a little overengineered problem and shepherd
itself is moving towards a more declarative API as we speak.

> > 2. It'd probably make shepherd a compile-time dependency, which is
> > avoided in other places in the code, i.e. (gnu build shepherd)
> 
> (gnu build shepherd) is 75% deprecated; the introduction of endpoints
> in the Shepherd didn’t have any effect on it.
Good to know.

> > 3. Shepherd records are (to my knowledge) not print-readable, so
> > we'd have to move them through G-Expressions through some of our
> > own code anyway; how strongly that would replicate the API is up to
> > debate/speculation.
> 
> When would you want to print those <endpoint> records?
When writing them to a shepherd init.scm :)

Cheers




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-05-03 16:54             ` Liliana Marie Prikler
@ 2023-05-10 15:14               ` Ludovic Courtès
  2023-05-10 18:32                 ` Liliana Marie Prikler
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2023-05-10 15:14 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986, Maxime Devos, Maxim Cournoyer

Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> Am Mittwoch, dem 03.05.2023 um 15:27 +0200 schrieb Ludovic Courtès:
>> It’s not just possible: several services in (gnu services …) and (gnu
>> home services …) use endpoints for systemd or inetd-style startup.
> True, but to my knowledge they don't yet allow the user to specify
> those endpoints directly.  At the very least, they didn't when I
> started this thread, which was shortly after shepherd itself gained
> endpoints.  I'm happy to be proven wrong on this point.

They don’t let users specify the endpoints as such, but closely enough.
For instance, the ‘interface’ field of <bitlbee-configuration> is used
to build it endpoint, and similarly for ‘openssh’ and ‘dicod’.

Overall, it seems to me we don’t need a first-class <endpoint> type in
Guix System itself.

I hope that makes sense!

Ludo’.




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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-05-10 15:14               ` Ludovic Courtès
@ 2023-05-10 18:32                 ` Liliana Marie Prikler
  2023-05-11 10:52                   ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: Liliana Marie Prikler @ 2023-05-10 18:32 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54986, Maxime Devos, Maxim Cournoyer

Am Mittwoch, dem 10.05.2023 um 17:14 +0200 schrieb Ludovic Courtès:
> Hi,
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:
> 
> > Am Mittwoch, dem 03.05.2023 um 15:27 +0200 schrieb Ludovic Courtès:
> > > It’s not just possible: several services in (gnu services …) and
> > > (gnu home services …) use endpoints for systemd or inetd-style
> > > startup.
> > True, but to my knowledge they don't yet allow the user to specify
> > those endpoints directly.  At the very least, they didn't when I
> > started this thread, which was shortly after shepherd itself gained
> > endpoints.  I'm happy to be proven wrong on this point.
> 
> They don’t let users specify the endpoints as such, but closely
> enough.  For instance, the ‘interface’ field of <bitlbee-
> configuration> is used to build it endpoint, and similarly for
> ‘openssh’ and ‘dicod’.
> 
> Overall, it seems to me we don’t need a first-class <endpoint> type
> in Guix System itself.
It's funny you would argue that, because imho openssh would actually be
a good candidate for supporting first-class endpoints:  Doing so would
allow the user to specify whether IPv4, IPv6 or both (default) should
be allowed for connections.  For other service that support sockets as
well as TCP/IP ports, the benefit would be even greater.

I understand that copypasting all the fields into Guix records is a bit
of a non-starter, but I don't think it's a good idea to simply give up.
I just need some pointers in which direction to continue.

Cheers





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

* [bug#54986] [PATCH] gnu: mpd: Add support for socket activation.
  2023-05-10 18:32                 ` Liliana Marie Prikler
@ 2023-05-11 10:52                   ` Ludovic Courtès
  0 siblings, 0 replies; 32+ messages in thread
From: Ludovic Courtès @ 2023-05-11 10:52 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54986, Maxime Devos, Maxim Cournoyer

Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> Am Mittwoch, dem 10.05.2023 um 17:14 +0200 schrieb Ludovic Courtès:
>> Hi,
>> 
>> Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:
>> 
>> > Am Mittwoch, dem 03.05.2023 um 15:27 +0200 schrieb Ludovic Courtès:
>> > > It’s not just possible: several services in (gnu services …) and
>> > > (gnu home services …) use endpoints for systemd or inetd-style
>> > > startup.
>> > True, but to my knowledge they don't yet allow the user to specify
>> > those endpoints directly.  At the very least, they didn't when I
>> > started this thread, which was shortly after shepherd itself gained
>> > endpoints.  I'm happy to be proven wrong on this point.
>> 
>> They don’t let users specify the endpoints as such, but closely
>> enough.  For instance, the ‘interface’ field of <bitlbee-
>> configuration> is used to build it endpoint, and similarly for
>> ‘openssh’ and ‘dicod’.
>> 
>> Overall, it seems to me we don’t need a first-class <endpoint> type
>> in Guix System itself.
> It's funny you would argue that, because imho openssh would actually be
> a good candidate for supporting first-class endpoints:  Doing so would
> allow the user to specify whether IPv4, IPv6 or both (default) should
> be allowed for connections.  For other service that support sockets as
> well as TCP/IP ports, the benefit would be even greater.

For the services I mentioned, I don’t feel that lack of first-class
endpoints is a hindrance in terms of flexibility.  We’re trading
expressivity for ease of use.

> I understand that copypasting all the fields into Guix records is a bit
> of a non-starter, but I don't think it's a good idea to simply give up.
> I just need some pointers in which direction to continue.

Like I wrote, I’m kinda skeptical about the idea.  :-)

Now, if you find good motivating examples and find a way to express
endpoints that remain concise in common cases, that may be more
appealing to me!

Ludo’.




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

end of thread, other threads:[~2023-05-11 10:53 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-17 10:01 [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Liliana Marie Prikler
2022-04-17 10:01 ` [bug#54986] [PATCH v2 1/3] " Liliana Marie Prikler
2022-04-17 21:06 ` [bug#54986] [PATCH] " Ludovic Courtès
2022-04-17 21:57   ` Liliana Marie Prikler
2022-04-18 21:05     ` Ludovic Courtès
2022-04-18 21:19       ` Liliana Marie Prikler
2022-04-27 20:56         ` Ludovic Courtès
2022-04-28 16:45           ` Liliana Marie Prikler
2022-04-23 14:25 ` [bug#54986] [PATCH v2 2/3 WIP] services: shepherd: Add support for socket activation endpoints Liliana Marie Prikler
2022-04-27 22:05   ` Ludovic Courtès
2022-04-23 14:25 ` [bug#54986] [PATCH v3 1/2] " Liliana Marie Prikler
2023-04-26  0:33   ` [bug#54986] [PATCH] gnu: mpd: Add support for socket activation Maxim Cournoyer
2023-04-26  4:28     ` Liliana Marie Prikler
2023-05-01 15:53       ` Maxim Cournoyer
2023-05-01 16:09         ` Liliana Marie Prikler
2023-05-03  3:17           ` Maxim Cournoyer
2023-05-03 13:27           ` Ludovic Courtès
2023-05-03 16:54             ` Liliana Marie Prikler
2023-05-10 15:14               ` Ludovic Courtès
2023-05-10 18:32                 ` Liliana Marie Prikler
2023-05-11 10:52                   ` Ludovic Courtès
2022-04-23 14:39 ` [bug#54986] [PATCH v3 2/2] services: mpd: Support " Liliana Marie Prikler
2022-10-23 11:38   ` Liliana Marie Prikler
2022-11-26 12:59     ` Liliana Marie Prikler
2022-04-23 14:39 ` [bug#54986] [PATCH v2 3/3 WIP] " Liliana Marie Prikler
2022-04-23 17:31   ` Maxime Devos
2022-04-23 18:36     ` Liliana Marie Prikler
2022-04-23 17:35   ` Maxime Devos
2022-04-23 18:28     ` Liliana Marie Prikler
2022-04-27 22:08   ` Ludovic Courtès
2022-05-13 15:55     ` [bug#54986] [PATCH] gnu: mpd: Add support for " Ludovic Courtès
2022-05-13 17:00       ` Liliana Marie Prikler

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).