From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IFpvAkF6/2HW7QAAgWs5BA (envelope-from ) for ; Sun, 06 Feb 2022 08:35:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IP3jOkB6/2GQvwAAauVa8A (envelope-from ) for ; Sun, 06 Feb 2022 08:35:28 +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 79D26113D6 for ; Sun, 6 Feb 2022 08:35:28 +0100 (CET) Received: from localhost ([::1]:35368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGc51-0006Ol-8s for larch@yhetil.org; Sun, 06 Feb 2022 02:35:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGbvu-0003ta-O4 for guix-patches@gnu.org; Sun, 06 Feb 2022 02:26:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42370) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGbvu-0003qR-67 for guix-patches@gnu.org; Sun, 06 Feb 2022 02:26:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nGbvu-0005lS-3h for guix-patches@gnu.org; Sun, 06 Feb 2022 02:26:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53676] [PATCH 4/5] services: pulseaudio: Add an extra-script-files configuration field. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Feb 2022 07:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53676 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 53676@debbugs.gnu.org Received: via spool by 53676-submit@debbugs.gnu.org id=B53676.164413231722089 (code B ref 53676); Sun, 06 Feb 2022 07:26:02 +0000 Received: (at 53676) by debbugs.gnu.org; 6 Feb 2022 07:25:17 +0000 Received: from localhost ([127.0.0.1]:36261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGbvB-0005kC-40 for submit@debbugs.gnu.org; Sun, 06 Feb 2022 02:25:17 -0500 Received: from mail-qv1-f47.google.com ([209.85.219.47]:40506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGbv8-0005jv-Og for 53676@debbugs.gnu.org; Sun, 06 Feb 2022 02:25:15 -0500 Received: by mail-qv1-f47.google.com with SMTP id v10so860953qvk.7 for <53676@debbugs.gnu.org>; Sat, 05 Feb 2022 23:25:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=RISkv4jWWcnSk77Dc3oHk/Qpyk0BiWtEZuNg6Yxwtg4=; b=SjPxnePnEiPzeYFxeDsHqQbgXDLZh+m6d01TbLYHKI2wWqYk1BFrkJA70H8d1FK9oT Rnoq6sDjhpLSOjjjlWLhZBtDJ+g6nuLsC44PBrPOIsVR47Zrk+t0gXR3kqfVceqvXCdv AuYORt9EK7kBRXrH0KPj1ZxFNT1YYr8WZ0U79yPo3KdrsPCskvWQKYO3dOSAwMEGDLr1 r0tUWT1GO4AcSehvHzTpFHmiFUuczrkzEU575Q1bacLcrASNUVETcD6ogt2hWbtC1AOZ m+7wqHI0B4Ua9usdiNFNr3WRJ4e4AMencKEzPGlk9VpRO2swLLaD2Ma+VupPLSa3oc8C 9XjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=RISkv4jWWcnSk77Dc3oHk/Qpyk0BiWtEZuNg6Yxwtg4=; b=FIFkWftlGnsdtaGHguOjoOORTE+TpLkDiXjRwY8rkPWmLNfPeXPYf1XxlZDQii0WPG 52Bx8bT9O3DfINTr8lqL9FDFyByDjow/3xv8xsuZRTzEtzwIMh5ZblhxjGEae7wG/1Vs XjHiu5jDbtWu3mEPjwMitjM14YuOkpd+WIhE3SQqOoBRpZPXAVHamSsVfgGf+oXSIMeS //4FWLEIy5xmgHMZt6O9rHd7wAqOCROgpdexLqUC/WoO670ii6KuKX8ftJ8g02IL+eXL hGZaI+nVHgkdQKqTX2SOYIcBH5Y+s/zeFD/fLik1pOe6GRN1gZ/PCyEx1BwRhY4duvRo PDDg== X-Gm-Message-State: AOAM533ATOt155k3mk2l3aEETFtrk5WyFhNW/GKV7SiBRnjQE2I6X/Sk O8XwuErGnONkdgGzQUaIUlc1HmrjR/M= X-Google-Smtp-Source: ABdhPJzyucaXUmmr26LAjr3VGAEbn/SdV+y3Ms9dPBh67cWtgxkwWf6OAGybsZ8mDqpl+A/vhinrzg== X-Received: by 2002:a05:6214:268d:: with SMTP id gm13mr4126269qvb.125.1644132308911; Sat, 05 Feb 2022 23:25:08 -0800 (PST) Received: from hurd (dsl-10-149-121.b2b2c.ca. [72.10.149.121]) by smtp.gmail.com with ESMTPSA id q8sm3549236qkl.65.2022.02.05.23.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Feb 2022 23:25:08 -0800 (PST) From: Maxim Cournoyer References: <20220201041933.16603-1-maxim.cournoyer@gmail.com> <20220201041933.16603-4-maxim.cournoyer@gmail.com> <97111754acacc576aec4eb55889a32474fe71f95.camel@gmail.com> <871r0m1gdy.fsf@gmail.com> <3c9845d7b893dddcd44be41d2ee475c29d9f5a85.camel@gmail.com> <87o83qyltg.fsf@gmail.com> <2b8017576ee2570fd38ab61729556e31694b2552.camel@gmail.com> Date: Sun, 06 Feb 2022 02:25:07 -0500 In-Reply-To: <2b8017576ee2570fd38ab61729556e31694b2552.camel@gmail.com> (Liliana Marie Prikler's message of "Wed, 02 Feb 2022 21:07:27 +0100") Message-ID: <87czk01mp8.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644132928; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: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=RISkv4jWWcnSk77Dc3oHk/Qpyk0BiWtEZuNg6Yxwtg4=; b=i4pBKRxnypCihq9ox8UGbBtoji/9IKq3yuCYZOtn7Ka240Fk1RWzg80LYWTa+VlaNAkKCy Ot0Y8M2NyspSudk7h5vle9mAxYw8yCb3WogdcobOKUaXXaAaWggvw269VzrhXUTjevczT/ dmKRk8yXgUB09FwvRTAAU8FuOA/fQqGhYMOFD7jEOM77txSd0JGRqMkF9g1c9cZGiwG9Jk CndwF5qymfMGr17XbIFIcXyvoTUwYbIjj4erNf2bVsH54Hfko+9T7E/6BqAs0QHYdGiOhs zLfENeQuGCf5/dyFeguMlYa292l/m6qp7QYC1jJNq/1oO730f30sSV+M2im+Tw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644132928; a=rsa-sha256; cv=none; b=Dk8Iw6vfHw3r2ycpstnpjrnLKeN1CnxZqHByQvGB5Ug9hJE1eyoyKIs/BvI58ByH3Pgdbd cl/sRhE3l6zlrZIkgRQ0RI1E7TtetOcPVDSwsKjH5kGYxJbxTPCgKF6eCgMtfKGm0RXAkY QD4yUH6rZ7VhNT95soYig0A+8/I2k+eSHC4LsCSI66EVwrKoSxe7Nc5tzAqQR05l9ZVWAs Lq7YwQv+nmZW2jwTGjE1FTi7hfQDjmwunUI1VEF3oKAlVyGMBkynmL+M2B1KDbqqxWpAYC GG9ytTgla61EuFOUsBQDomoFCU14iLm/cQziy0/W/5rzYNJNgPF0eJVs7yNJGg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=SjPxnePn; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=SjPxnePn; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 79D26113D6 X-Spam-Score: -3.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4kTLcHIZik1y Hi Liliana, [...] >> 'strip-store-file-name' would be able to get the name from the store >> item (built derivation), but file-union takes a "two-element list >> where the first element is the file name to use in the new directory, >> and the second element is a gexp denoting the target file", e.g., >> before the file-like object is built.=C2=A0 I don't see an easy way to >> make it work. > For the record, I do think we'd like to use file-like objects here, not > raw gexps. If that fails, why not expose the name to gexp mapping > completely? I don't know why you'd want to take away that control. If we limit ourselves to file-like objects, we can do something like this: --8<---------------cut here---------------start------------->8--- 1 file changed, 20 insertions(+), 4 deletions(-) gnu/services/sound.scm | 24 ++++++++++++++++++++---- modified gnu/services/sound.scm @@ -26,10 +26,12 @@ (define-module (gnu services sound) #:use-module (gnu services) #:use-module (gnu system pam) #:use-module (gnu system shadow) + #:use-module (guix diagnostics) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix records) #:use-module (guix store) + #:use-module (guix ui) #:use-module (gnu packages audio) #:use-module (gnu packages linux) #:use-module (gnu packages pulseaudio) @@ -149,10 +151,24 @@ (define pulseaudio-environment ("PULSE_CLIENTCONFIG" . "/etc/pulse/client.conf"))))) =20 (define (extra-script-files->file-union extra-script-files) - "Return a G-exp obtained by processing EXTRA-SCRIPT-FILES with FILE-UNIO= N. -Each file is named \"snippet-n.pa\", where N is their 1-offset index." - (let ((labels (map (lambda (n) (format #f "snippet-~a.pa" n)) - (iota (length extra-script-files) 1)))) + "Return a G-exp obtained by processing EXTRA-SCRIPT-FILES with FILE-UNIO= N." + + (define (file-like->name file) + (let ((name (match file + ((? local-file?) + (local-file-name file)) + ((? plain-file?) + (plain-file-name file)) + ((? computed-file?) + (computed-file-name file)) + (_ (leave (G_ "~a is not a local-file, plain-file or \ +computed-file object~%") file))))) + (unless (string-suffix? name ".pa") + (leave (G_ "`~a' lacks the required '.pa' file name extension~%") + name)) + name)) + + (let ((labels (map file-like->name extra-script-files))) (file-union "default.pa.d" (zip labels extra-script-files)))) =20 (define pulseaudio-etc --8<---------------cut here---------------end--------------->8--- It works; and I agree it's nice to have control over the file name. Maxim