guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#53676] [PATCH 0/5] *** PulseAudio service improvements ***


From: Maxim Cournoyer
Subject: [bug#53676] [PATCH 0/5] *** PulseAudio service improvements ***
Date: Sun, 06 Feb 2022 01:30:33 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Hi,
>
> Am Dienstag, dem 01.02.2022 um 23:30 -0500 schrieb Maxim Cournoyer:
>> If someone was to append something to default.pa (the exact one shipped
>> with PulseAudio), they'd have to add the .fail themselves to undo
>> PulseAudio's own .nofail, right?  I don't see why we should go out of
>> our way to change that.
> Didn't you add that .nofail on your own?  If not, why include the
> directive?

You are right that it's not needed.  I've reviewed how that's done, see
below.

>> With the proposed 'extra-script-files', I'd argue that appending
>> something to default.pa should be considered an anti-pattern; as the
>> new field would be the more natural option to *extend* 'default.pa'
>> (and having a field to override default.pa is still useful if you don't
>> like any of the default behavior).
> I don't think you're making a good case here.  Why do you want
> appending to default.pa to be an anti-pattern?

Basically, to keep things as simple as they can be.  I'm expecting that
extending the default.pa file must be a more common use case than
hacking it up, justifying the 'extra-script-files' simple entry point
catered for this use case.  Compare:

--8<---------------cut here---------------start------------->8---
(script-file (computed-file "default.pa"
                            #~(begin
                                (copy-file #$(file-apend pulseaudio 
"/etc/default.pa")
                                           #$output)
                                (call-with-port
                                  (open-file #$output "a")
                                    (lambda (port)
                                      (format port "~%\
set-card-profile alsa_card.pci-0000_01_01.0 
output:analog-surround-40+input:analog-mono
set-default-source alsa_input.pci-0000_01_01.0.analog-mono
set-default-sink alsa_output.pci-0000_01_01.0.analog-surround-40~%"))))))
--8<---------------cut here---------------end--------------->8---

to:

--8<---------------cut here---------------start------------->8---
(extra-script-files
  (list (plain-file "configure-audigy-card"
          (string-append "\
set-card-profile alsa_card.pci-0000_01_01.0 
output:analog-surround-40+input:analog-mono
set-default-source alsa_input.pci-0000_01_01.0.analog-mono
set-default-sink alsa_output.pci-0000_01_01.0.analog-surround-40\n"))))
--8<---------------cut here---------------end--------------->8---

The later seems simpler, especially for someone starting with Guix and
not very familiar with Guile and G-expressions.

[...]

> That aside, I think substitute* would be expressing your intent better
> here, because what you actually want is to match that line and then
> append an .include /etc/pulse/default.pa.d hardcoded.

Good idea; I've made the change, like so:

--8<---------------cut here---------------start------------->8---
modified   gnu/packages/pulseaudio.scm
@@ -279,13 +279,12 @@ (define pulseaudio/fixed
         `(modify-phases ,phases
            (add-after 'unpack 'customize-default-script
              (lambda _
-               (call-with-port
-                (open-file "src/daemon/default.pa.in" "a")
-                (lambda (port)
-                  (format port "~%\
-### Include extra script files configured via the pulseaudio-service-type.
-.nofail
-.include /etc/pulse/default.pa.d~%")))))))))))
+               (substitute* "src/daemon/default.pa.in"
+                 (("^\\.include.*default.pa.d.*" anchor)
+                  (string-append
+                   ;; Honor PulseAudio script extensions found under
+                   ;; /etc/pulse/default.pa.d.
+                   anchor ".include /etc/pulse/default.pa.d\n")))))))))))
 
 (define-public pavucontrol
   (package
--8<---------------cut here---------------end--------------->8---

> I still don't agree that that's a good idea, however.  Particularly, it
> would lead to including files from an "old distro" that was infected
> with Guix when that probably wasn't asked for.  If at all enabled, I'd
> prefer if pulseaudio-service-type magically inserted that snippet for
> configurations that add files to default.pa.d.

There are pros and cons; people might be find it handy that a
Guix-installed pulseaudio also honors their user scripts living under
/etc/pulse/default.pa.d.  It seems low risk to me; not worth the extra
complexity in my opinion.

Thanks,

Maxim





reply via email to

[Prev in Thread] Current Thread [Next in Thread]