[bug#54986] gnu: mpd: Add support for socket activation.
Commit Message
* 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(-)
Comments
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’.
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
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’.
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.
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’.
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
@@ -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