diff options
| author | Ian Eure <ian@retrospec.tv> | 2025-11-08 15:23:03 -0800 |
|---|---|---|
| committer | Ian Eure <ian@retrospec.tv> | 2025-11-08 16:26:14 -0800 |
| commit | 2be1e10e36868a6f1a4f73c00adf1a6848acb8cd (patch) | |
| tree | 8e91e5a039e274f25d1e9ca7c5bb1a189bd528a5 | |
| parent | 788e88e6f0d0620a161ec4f5e9319977843b3c28 (diff) | |
gnu: mpd-service-type: Remove `group' from configuration.
Use of the `group' option in the MPD configuration behaves oddly: when it’s
present, the MPD process runs without the supplementary groups the user is in.
Leaving it unspecified does the right thing, the process gets both the primary
and supplementary groups. So, don’t serialize that option at all.
* gnu/services/audio.scm (%mpd-user): Use %mpd-group.
(mpd-configuration): Remove `group' field.
(mpd-configuration-group): Unexport.
(mpd-group-sanitizer): Delete variable.
(mpd-accounts): Create group if it’s `%mpd-group'.
(mpd-serialize-user-group): Remove.
Change-Id: I0c20c817ba7fd892c96497208ca5338088f74252
| -rw-r--r-- | gnu/services/audio.scm | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 5091d7fc137..34e858d25d3 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm | |||
| @@ -67,7 +67,6 @@ | |||
| 67 | mpd-configuration? | 67 | mpd-configuration? |
| 68 | mpd-configuration-package | 68 | mpd-configuration-package |
| 69 | mpd-configuration-user | 69 | mpd-configuration-user |
| 70 | mpd-configuration-group | ||
| 71 | mpd-configuration-shepherd-requirement | 70 | mpd-configuration-shepherd-requirement |
| 72 | mpd-configuration-log-file | 71 | mpd-configuration-log-file |
| 73 | mpd-configuration-log-level | 72 | mpd-configuration-log-level |
| @@ -173,30 +172,25 @@ | |||
| 173 | (define (mpd-serialize-user-account field-name value) | 172 | (define (mpd-serialize-user-account field-name value) |
| 174 | (mpd-serialize-string field-name (user-account-name value))) | 173 | (mpd-serialize-string field-name (user-account-name value))) |
| 175 | 174 | ||
| 176 | (define (mpd-serialize-user-group field-name value) | ||
| 177 | (mpd-serialize-string field-name (user-group-name value))) | ||
| 178 | |||
| 179 | (define-maybe string (prefix mpd-)) | 175 | (define-maybe string (prefix mpd-)) |
| 180 | (define-maybe list-of-strings (prefix mpd-)) | 176 | (define-maybe list-of-strings (prefix mpd-)) |
| 181 | (define-maybe boolean (prefix mpd-)) | 177 | (define-maybe boolean (prefix mpd-)) |
| 182 | 178 | ||
| 179 | (define %mpd-group | ||
| 180 | (user-group | ||
| 181 | (name "mpd") | ||
| 182 | (system? #t))) | ||
| 183 | |||
| 183 | (define %mpd-user | 184 | (define %mpd-user |
| 184 | (user-account | 185 | (user-account |
| 185 | (name "mpd") | 186 | (name "mpd") |
| 186 | ;; XXX: This is a place-holder to be lazily substituted in (…-accounts) | 187 | (group (user-group-name %mpd-group)) |
| 187 | ;; with the value from the 'group' field of <mpd-configuration>. | ||
| 188 | (group %lazy-group) | ||
| 189 | (system? #t) | 188 | (system? #t) |
| 190 | (comment "Music Player Daemon (MPD) user") | 189 | (comment "Music Player Daemon (MPD) user") |
| 191 | ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data. | 190 | ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data. |
| 192 | (home-directory "/var/lib/mpd") | 191 | (home-directory "/var/lib/mpd") |
| 193 | (shell (file-append shadow "/sbin/nologin")))) | 192 | (shell (file-append shadow "/sbin/nologin")))) |
| 194 | 193 | ||
| 195 | (define %mpd-group | ||
| 196 | (user-group | ||
| 197 | (name "mpd") | ||
| 198 | (system? #t))) | ||
| 199 | |||
| 200 | ;;; TODO: Procedures for deprecated fields, to be removed. | 194 | ;;; TODO: Procedures for deprecated fields, to be removed. |
| 201 | 195 | ||
| 202 | (define mpd-deprecated-fields '((music-dir . music-directory) | 196 | (define mpd-deprecated-fields '((music-dir . music-directory) |
| @@ -239,17 +233,6 @@ user-account instead~%")) | |||
| 239 | (else | 233 | (else |
| 240 | (configuration-field-error #f 'user value)))) | 234 | (configuration-field-error #f 'user value)))) |
| 241 | 235 | ||
| 242 | (define (mpd-group-sanitizer value) | ||
| 243 | (cond ((user-group? value) value) | ||
| 244 | ((string? value) | ||
| 245 | (warning (G_ "string value for 'group' is deprecated, use \ | ||
| 246 | user-group instead~%")) | ||
| 247 | (user-group | ||
| 248 | (inherit %mpd-group) | ||
| 249 | (name value))) | ||
| 250 | (else | ||
| 251 | (configuration-field-error #f 'group value)))) | ||
| 252 | |||
| 253 | (define (mpd-log-file-sanitizer value) | 236 | (define (mpd-log-file-sanitizer value) |
| 254 | ;; XXX: While leaving the 'sys_log' option out of the mpd.conf file is | 237 | ;; XXX: While leaving the 'sys_log' option out of the mpd.conf file is |
| 255 | ;; supposed to cause logging to happen via systemd (elogind provides a | 238 | ;; supposed to cause logging to happen via systemd (elogind provides a |
| @@ -417,11 +400,6 @@ to be appended to the audio output configuration.") | |||
| 417 | "The user to run mpd as." | 400 | "The user to run mpd as." |
| 418 | (sanitizer mpd-user-sanitizer)) | 401 | (sanitizer mpd-user-sanitizer)) |
| 419 | 402 | ||
| 420 | (group | ||
| 421 | (user-group %mpd-group) | ||
| 422 | "The group to run mpd as." | ||
| 423 | (sanitizer mpd-group-sanitizer)) | ||
| 424 | |||
| 425 | (shepherd-requirement | 403 | (shepherd-requirement |
| 426 | (list-of-symbols '()) | 404 | (list-of-symbols '()) |
| 427 | "This is a list of symbols naming Shepherd services that this service | 405 | "This is a list of symbols naming Shepherd services that this service |
| @@ -650,12 +628,12 @@ appended to the configuration.") | |||
| 650 | (format #t "Service MPD is not running."))))))))))) | 628 | (format #t "Service MPD is not running."))))))))))) |
| 651 | 629 | ||
| 652 | (define (mpd-accounts config) | 630 | (define (mpd-accounts config) |
| 653 | (match-record config <mpd-configuration> (user group) | 631 | (match-record config <mpd-configuration> (user) |
| 654 | ;; TODO: Deprecation code, to be removed. | 632 | `(,user |
| 655 | (let ((user (if (eq? (user-account-group user) %lazy-group) | 633 | ;; Create %mpd-group if that's what we're using. |
| 656 | (set-user-group user group) | 634 | ,(when (string=? (user-group-name %mpd-group) |
| 657 | user))) | 635 | (user-account-group user)) |
| 658 | (list user group)))) | 636 | %mpd-group)))) |
| 659 | 637 | ||
| 660 | (define mpd-service-type | 638 | (define mpd-service-type |
| 661 | (service-type | 639 | (service-type |
