diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-11-06 22:58:28 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-11-06 22:59:19 +0100 |
commit | 7209d7cbc37c108ca1148561a681258bb2222ab1 (patch) | |
tree | c043e5a53d47bd809257902ff571de083c6ad9d5 /gnu/services/audio.scm | |
parent | db1b18c397fb2f9892ebce82bbea5998ce27fbb4 (diff) | |
download | guix-7209d7cbc37c108ca1148561a681258bb2222ab1.tar.gz |
services: mpd: Always create the "mpd" user account.
* gnu/services/audio.scm (%mpd-accounts): New variable. (mpd-service-type)[extensions]: Add ACCOUNT-SERVICE-TYPE extension.
Diffstat (limited to 'gnu/services/audio.scm')
-rw-r--r-- | gnu/services/audio.scm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 5d33032501..5729b6bb0e 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com> ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,6 +22,8 @@ #:use-module (guix gexp) #:use-module (gnu services) #:use-module (gnu services shepherd) + #:use-module (gnu system shadow) + #:use-module (gnu packages admin) #:use-module (gnu packages mpd) #:use-module (guix records) #:use-module (ice-9 match) @@ -162,6 +165,22 @@ audio_output { (mkdir-p directory) (chown directory (passwd:uid %user) (passwd:gid %user)))))) + +(define %mpd-accounts + ;; Default account and group for MPD. + (list (user-group (name "mpd") (system? #t)) + (user-account + (name "mpd") + (group "mpd") + (system? #t) + (comment "Music Player Daemon (MPD) user") + + ;; Note: /var/run/mpd hosts one sub-directory per user, of which + ;; /var/run/mpd/mpd corresponds to the "mpd" user. + (home-directory "/var/run/mpd/mpd") + + (shell (file-append shadow "/sbin/nologin"))))) + (define mpd-service-type (service-type (name 'mpd) @@ -169,6 +188,8 @@ audio_output { (extensions (list (service-extension shepherd-root-service-type (compose list mpd-shepherd-service)) + (service-extension account-service-type + (const %mpd-accounts)) (service-extension activation-service-type mpd-service-activation))) (default-value (mpd-configuration)))) |