Subject: Re: [PATCH v2 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields.

From: Liliana Marie Prikler <[email-masked]>
Date: Thu, 23 Mar 2023 19:03:45 +0100

Am Donnerstag, dem 23.03.2023 um 15:02 +0000 schrieb Bruno Victal:
> If a string value is encountered, it is ignored and a predefined
> variable is used instead. This is essentially a rollback to how it
> used to be before '5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1'.
As far as I can see, this is not actually what happens.  Don't forget
to update your commit messages :)

> Fixes #61570 <https://issues.guix.gnu.org/61570>.
You only need one newline after this one imho.
> --- a/gnu/services/audio.scm
> +++ b/gnu/services/audio.scm
> @@ -140,6 +140,14 @@ (define (uglify-field-name field-name)
>  (define list-of-symbol?
>    (list-of symbol?))
>  
> +;; helpers for deprecated field types, to be removed later
> +(define %lazy-group (make-symbol "%lazy-group"))
> +
> +(define (inject-group-into-user user group)
> +  (user-account
> +   (inherit user)
> +   (group (user-group-name group))))
> +
>  
>  ;;;
>  ;;; MPD
> @@ -559,17 +620,11 @@ (define (mpd-shepherd-service config)
>  
>  (define (mpd-accounts config)
>    (match-record config <mpd-configuration> (user group)
> -    (list (user-group
> -           (name group)
> -           (system? #t))
> -          (user-account
> -           (name user)
> -           (group group)
> -           (system? #t)
> -           (comment "Music Player Daemon (MPD) user")
> -           ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its
> data
> -           (home-directory "/var/lib/mpd")
> -           (shell (file-append shadow "/sbin/nologin"))))))
> +    ;; TODO: deprecation code, to be removed
> +    (let ((user (if (eq? (user-account-group user) %lazy-group)
> +                    (inject-group-into-user user group)
> +                    user)))
> +      (list user group))))
A little over-engineered, but works for me :)

Cheers