all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 0/1] MPD: Install systemd service files
@ 2016-12-29 16:34 Leo Famulari
  2016-12-29 16:34 ` [PATCH 1/1] gnu: mpd: " Leo Famulari
  2016-12-29 18:24 ` [PATCH 0/1] MPD: " Marius Bakke
  0 siblings, 2 replies; 4+ messages in thread
From: Leo Famulari @ 2016-12-29 16:34 UTC (permalink / raw)
  To: guix-devel

I noticed that MPD 0.19.21 adds a systemd service file for unprivileged
users:

http://git.musicpd.org/cgit/master/mpd.git/plain/NEWS?h=v0.19.21

It works for me! 

This patch installs both the privileged and unprivileged service files.

I wonder, is this installation path correct? Should they be at

~/.guix-profile/etc/systemd[...] (my patch does this)

or should the path be "namespaced" to MPD, like this:

~/.guix-profile/etc/mpd/systemd[...]

?

Leo Famulari (1):
  gnu: mpd: Install systemd service files.

 gnu/packages/mpd.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
2.11.0

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

* [PATCH 1/1] gnu: mpd: Install systemd service files.
  2016-12-29 16:34 [PATCH 0/1] MPD: Install systemd service files Leo Famulari
@ 2016-12-29 16:34 ` Leo Famulari
  2016-12-29 18:24 ` [PATCH 0/1] MPD: " Marius Bakke
  1 sibling, 0 replies; 4+ messages in thread
From: Leo Famulari @ 2016-12-29 16:34 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/mpd.scm (mpd)[arguments]: Add 'install-service-files' phase.
---
 gnu/packages/mpd.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gnu/packages/mpd.scm b/gnu/packages/mpd.scm
index 36a31048a..5231c3f7f 100644
--- a/gnu/packages/mpd.scm
+++ b/gnu/packages/mpd.scm
@@ -85,6 +85,17 @@ interfacing MPD in the C, C++ & Objective C languages.")
                (base32
                 "0c0p61p3jfh89pnqwd9nrw55krfvvnzhkpdq53g6njvg0aybh1c3"))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-service-files
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (systemd (string-append out "/etc/systemd/system"))
+                    (systemd-user (string-append out "/etc/systemd/user")))
+               (install-file "systemd/system/mpd.service" systemd)
+               (install-file "systemd/user/mpd.service" systemd-user)
+               #t))))))
     (inputs `(("ao" ,ao)
               ("alsa-lib" ,alsa-lib)
               ("avahi" ,avahi)
-- 
2.11.0

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

* Re: [PATCH 0/1] MPD: Install systemd service files
  2016-12-29 16:34 [PATCH 0/1] MPD: Install systemd service files Leo Famulari
  2016-12-29 16:34 ` [PATCH 1/1] gnu: mpd: " Leo Famulari
@ 2016-12-29 18:24 ` Marius Bakke
  2016-12-29 18:35   ` Leo Famulari
  1 sibling, 1 reply; 4+ messages in thread
From: Marius Bakke @ 2016-12-29 18:24 UTC (permalink / raw)
  To: Leo Famulari, guix-devel

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

Leo Famulari <leo@famulari.name> writes:

> I noticed that MPD 0.19.21 adds a systemd service file for unprivileged
> users:
>
> http://git.musicpd.org/cgit/master/mpd.git/plain/NEWS?h=v0.19.21
>
> It works for me! 
>
> This patch installs both the privileged and unprivileged service files.
>
> I wonder, is this installation path correct? Should they be at
>
> ~/.guix-profile/etc/systemd[...] (my patch does this)

Yes. Unit names in managed packages should not conflict, so no further
namespacing necessary. This way users can just sync/link units from
<guix-profile>/etc/systemd/{user,system} to the respective system
locations.

Btw, Shepherd works in user mode too ;-)

Here is a config that defines a service for "mcron":

$ cat ~/.config/shepherd/init.scm
(define mcron (make <service>
                    #:provides '(mcron)
                    #:start (make-forkexec-constructor
                             (list "/run/current-system/profile/bin/mcron"))
                    #:stop (make-kill-destructor)))
(register-services mcron)

I guess it would be better to re-use the Guix service definition, but
haven't gotten that far yet.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: [PATCH 0/1] MPD: Install systemd service files
  2016-12-29 18:24 ` [PATCH 0/1] MPD: " Marius Bakke
@ 2016-12-29 18:35   ` Leo Famulari
  0 siblings, 0 replies; 4+ messages in thread
From: Leo Famulari @ 2016-12-29 18:35 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel

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

On Thu, Dec 29, 2016 at 07:24:19PM +0100, Marius Bakke wrote:
> Leo Famulari <leo@famulari.name> writes:
> 
> > I noticed that MPD 0.19.21 adds a systemd service file for unprivileged
> > users:
> >
> > http://git.musicpd.org/cgit/master/mpd.git/plain/NEWS?h=v0.19.21
> >
> > It works for me! 
> >
> > This patch installs both the privileged and unprivileged service files.
> >
> > I wonder, is this installation path correct? Should they be at
> >
> > ~/.guix-profile/etc/systemd[...] (my patch does this)
> 
> Yes. Unit names in managed packages should not conflict, so no further
> namespacing necessary. This way users can just sync/link units from
> <guix-profile>/etc/systemd/{user,system} to the respective system
> locations.

Good point, thank you!

> Btw, Shepherd works in user mode too ;-)

I use it myself :)

> Here is a config that defines a service for "mcron":
> 
> $ cat ~/.config/shepherd/init.scm
> (define mcron (make <service>
>                     #:provides '(mcron)
>                     #:start (make-forkexec-constructor
>                              (list "/run/current-system/profile/bin/mcron"))
>                     #:stop (make-kill-destructor)))
> (register-services mcron)

I'm glad to see this example here. It took me a long time to find an
example of a user service when I was getting started.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2016-12-29 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-29 16:34 [PATCH 0/1] MPD: Install systemd service files Leo Famulari
2016-12-29 16:34 ` [PATCH 1/1] gnu: mpd: " Leo Famulari
2016-12-29 18:24 ` [PATCH 0/1] MPD: " Marius Bakke
2016-12-29 18:35   ` Leo Famulari

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.