From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CC53AiQT8WOV4AAAbAwnHQ (envelope-from ) for ; Sat, 18 Feb 2023 19:04:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 8LOLAiQT8WNiaAAA9RJhRA (envelope-from ) for ; Sat, 18 Feb 2023 19:04:20 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7948A15B43 for ; Sat, 18 Feb 2023 19:04:19 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=c5RtbcOF; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676743459; a=rsa-sha256; cv=none; b=o7RHN73FYRXDUl24+XEfnHG5ertkVw1hLYxOzEER0/moOYCJZZ2ujISMa8p7pIY22eim9z tSCm3POUjSXQdKZPAvVkURbwdikKzTUa8muIUY/Y5fRhsWhsNlTJORRHdZmNRjcbtqiymq Yvv2W3fLdDkVTdSwqaYrFXwO6zYvJxLVKGb3oWJ4tiwNn7VTvD/cQQVOs/2GmehtQTQ3gb nkT2L5tCpyyBaYPkQ6IG3wC+eVm68GeQsbOsoWkTd8pS4C5ZtLyQk4Zsp24mTlM4t41D+W qRchBZ0ZoZ6vnQ9HEVs7MqWftvzLV2rnmXeeqHaN5QXJX1STEsYMqBSDohVFuA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=c5RtbcOF; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676743459; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=00gYDwnEjFTLnr4F1EcNAlSk51LjyHBA4pjYXlttGtc=; b=Hr4Y0JnMEF7aF40mmQYduEJlgxiEOBEtrohaIdFv1CD9YFM8WN6piSZiBO0fMhG2DPUv8h oyDPpzbwFqZ8CvwgpZbXCe3yPTn6560MULByqw5GrUJ5b3mmIXfJF2wmpsglFzO6ekqs36 81e4AAnldXbzDWb/x+F7VAqOiSlexBL8QTT6bhro5Ik13LCYRw9XNcrEUZTvmqdZEQc+7J sT1wtn6RHygSr58M7Tbtm1HHIXx0uQCfIoc0Dkd8EaDYtI3Zj6eTmZdCPV/YaZ/NSI5fpV lrPV9jUld3AKU3HTWATw8vr1sn+ZpB80j5nAFOaGg9NEa6u4mbjUbhr3300wzQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTRZ8-0001NL-Ai; Sat, 18 Feb 2023 13:04:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTRZ4-0001Ms-Lx for bug-guix@gnu.org; Sat, 18 Feb 2023 13:04:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pTRZ4-0004FL-Ax for bug-guix@gnu.org; Sat, 18 Feb 2023 13:04:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pTRZ3-0005fL-S6 for bug-guix@gnu.org; Sat, 18 Feb 2023 13:04:01 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#61570: [PATCH] services: mpd: Use proper records. References: <87y1owsbab.fsf@gmail.com> In-Reply-To: <87y1owsbab.fsf@gmail.com> Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 18 Feb 2023 18:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61570 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Maxim Cournoyer , Bruno Victal Cc: 61570@debbugs.gnu.org Received: via spool by 61570-submit@debbugs.gnu.org id=B61570.167674338221706 (code B ref 61570); Sat, 18 Feb 2023 18:04:01 +0000 Received: (at 61570) by debbugs.gnu.org; 18 Feb 2023 18:03:02 +0000 Received: from localhost ([127.0.0.1]:44916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTRY6-0005e1-Dx for submit@debbugs.gnu.org; Sat, 18 Feb 2023 13:03:02 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36703) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTRY4-0005dY-TF for 61570@debbugs.gnu.org; Sat, 18 Feb 2023 13:03:01 -0500 Received: by mail-wr1-f67.google.com with SMTP id bv9so777263wrb.3 for <61570@debbugs.gnu.org>; Sat, 18 Feb 2023 10:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:cc:to:subject:date:from:from:to:cc:subject :date:message-id:reply-to; bh=00gYDwnEjFTLnr4F1EcNAlSk51LjyHBA4pjYXlttGtc=; b=c5RtbcOF46BDpDrA+aDF+mvjC82YJfyTpRVfi0oZUuJ70coKtbnr9QHcpS2dfCW4q6 P5dVgue0cwiWJ/0dVwAOnSNIOGdQyKamIHWhQhyHS98SIjdNlG0oDUPI16KasiUPBRk4 ujFXXAqJn6VQPP1xzLlOd3FniYAy/oaLrQXvc8TfFEWPik/cigcDNQgkYHDhb5/KMq3/ Xf6ndwm+8TN62ih8VTaUp9H1am+XTwHh2XgcDPzi8BzsLHRtj/TV+l26adNLai7rBuJp nh5ArXDFB+Pl3MGMwbXC5qEAvXgLDwOHLr2hDGRCA1jBbzFT/umgZI0Ap5iH8yDyGNw9 WDCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:cc:to:subject:date:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=00gYDwnEjFTLnr4F1EcNAlSk51LjyHBA4pjYXlttGtc=; b=wpvc6sLuOz20VX0Ag6qIpryj/WC9HNpK9ocCMkKEjN16awYRTszq7/qic/mcj9nFmJ KH5bWvb9sCJwt4KChMssHeWQPwwN0zm7WMLAmC39wtxm71m2rFgkfNaGH34q9weWEt81 s+wl1/WIrQG9ON+ljWyE8T6Tg2/VLmLPL60PsRKHpDBvdFHsrTOLVV4QkgempEWLUOIl 3GFhhmRbk9SJjW+56uxeSpXpkyk6w4MkZ+BoCV31ooYXzMzZrO0SP9nL0U5+Z7HF12mY R3sg5FHluSEQCtC1TiNTcO1OLd3F2gqYdbsuD5kh78r8QRIUCEn/3p7bIFEeV5wwEjBw DjIQ== X-Gm-Message-State: AO0yUKUaTLOKlVuQ+oNYoEo7ZlcHXLCkklIDUVRJg+JYWVf984kks/4+ iW/2bXmOnrej1bRCYlw0Tec= X-Google-Smtp-Source: AK7set+6Zk21Tp5gT8jEUfK1kFbrO+ER3zRDLAK3qq43AuPGW4dcly4HOlts9wr6mtibsJwVr+/M3A== X-Received: by 2002:adf:e610:0:b0:2c5:48ed:d258 with SMTP id p16-20020adfe610000000b002c548edd258mr1683884wrm.35.1676743374909; Sat, 18 Feb 2023 10:02:54 -0800 (PST) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id r18-20020adfe692000000b002c5a790e959sm5574236wrm.19.2023.02.18.10.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 10:02:54 -0800 (PST) From: Liliana Marie Prikler Date: Sat, 18 Feb 2023 18:42:45 +0100 Message-ID: <08fff16dcb7b4e2da9f4e2e05d010b1ea339b776.camel@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: X-Migadu-Queue-Id: 7948A15B43 X-Spam-Score: -2.83 X-Migadu-Spam-Score: -2.83 X-Migadu-Scanner: scn0.migadu.com List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-TUID: sRS5BG7chmZ8 * gnu/services/audio.scm (mpd-user, mpd-group): New variables. (mpd-serialize-user-account, mpd-serialize-user-group): New variables. (mpd-configuration)[user]: Change type to user-account. Change default accordingly. [group]: Change type to user-group. Change default accordingly. (mpd-shepherd-service, mpd-accounts): Adjust accordingly. * doc/guix.texi ("Music Player Daemon") Adjust accordingly. --- This patch fixes the issue of not being able to insert actual users and groups into MPD service. Sadly, as define-configuration lacks proper support for sanitizers, it's a backwards-incompatible change. Perhaps it makes sense to extend define-configuration to support this case? Cheers doc/guix.texi | 4 ++-- gnu/services/audio.scm | 41 +++++++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 44e2165a82..fa75eff62e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33181,10 +33181,10 @@ Data type representing the configuration of @command{mpd}. @item @code{package} (default: @code{mpd}) (type: file-like) The MPD package. -@item @code{user} (default: @code{"mpd"}) (type: string) +@item @code{user} (default: @code{(mpd-user "mpd")}) (type: user-account) The user to run mpd as. -@item @code{group} (default: @code{"mpd"}) (type: string) +@item @code{group} (default: @code{(mpd-group "mpd")}) (type: user-group) The group to run mpd as. @item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbol) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index d55b804ba9..df9b0ac7f1 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -62,6 +62,9 @@ (define-module (gnu services audio) mpd-partition-name mpd-partition-extra-options + mpd-user + mpd-group + mpd-configuration mpd-configuration? mpd-configuration-package @@ -328,6 +331,26 @@ (define list-of-mpd-plugin-or-output? (list-of (lambda (x) (or (mpd-output? x) (mpd-plugin? x))))) +(define* (mpd-user #:optional (name "mpd") (group "mpd")) + (user-account + (name name) + (group group) + (system? #t) + (comment "Music Player Daemon (MPD) user") + (home-directory "/var/lib/mpd") + (shell (file-append shadow "/sbin/nologin")))) + +(define* (mpd-group #:optional (name "mpd")) + (user-group + (name name) + (system? #t))) + +(define (mpd-serialize-user-account field value) + (mpd-serialize-string field (user-account-name value))) + +(define (mpd-serialize-user-group field value) + (mpd-serialize-string field (user-group-name value))) + (define-configuration mpd-configuration (package (file-like mpd) @@ -335,11 +358,11 @@ (define-configuration mpd-configuration empty-serializer) (user - (string "mpd") + (user-account (mpd-user "mpd")) "The user to run mpd as.") (group - (string "mpd") + (user-group (mpd-group "mpd")) "The group to run mpd as.") (shepherd-requirement @@ -512,7 +535,7 @@ (define (mpd-shepherd-service config) (and=> #$(maybe-value log-file) (compose mkdir-p dirname)) - (let ((user (getpw #$user))) + (let ((user (getpw #$(user-account-name user)))) (for-each (lambda (x) (when (and x (not (file-exists? x))) @@ -546,17 +569,7 @@ (define (mpd-shepherd-service config) (define (mpd-accounts config) (match-record config (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")))))) + (list user group))) (define mpd-service-type (service-type base-commit: 312f1f41d3f3f3e5d2c36ff46920c6dce1c21a17 -- 2.39.1