Package: guix-patches;
Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Date: Tue, 1 Feb 2022 04:15:02 UTC
Severity: normal
Tags: patch
Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Cc: 53676 <at> debbugs.gnu.org Subject: [bug#53676] [PATCH 0/5] *** PulseAudio service improvements *** Date: Sun, 06 Feb 2022 10:07:38 +0100
Hi Maxim, Am Sonntag, dem 06.02.2022 um 01:30 -0500 schrieb Maxim Cournoyer: > > > 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--- to: --8<---------------cut here---------------start------------->8--- (script-file (mixed-text-file "default.pa" ".include" ;; (pulseaudio-configuration-script-file service) (file-append pulseaudio "/etc/default.pa") " 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--- which yields --8<---------------cut here---------------start------------->8--- .include /gnu/store/7xwgz4bavb1i8sfx1lm55hlrr3ngjkdx-pulseaudio- 15.0/etc/default.pa 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--- > The later seems simpler, especially for someone starting with Guix and > not very familiar with Guile and G-expressions. That's because you're (intentionally or otherwise) not making a fair comparison. The way I wrote above is the way I intended pulseaudio- service-type to be used and it's in terms of writing the pulseaudio configuration not that much harder than what you are proposing. It'd be trivial to add a clause to ".include /etc/pulse/default.pa.d" through the service configuration layer. Also with pulseaudio < 15.0, you could – after groking gexps a little – produce --8<---------------cut here---------------start------------->8--- .include /gnu/store/7xwgz4bavb1i8sfx1lm55hlrr3ngjkdx-pulseaudio- 15.0/etc/default.pa .include /gnu/store/12345678901234567890123456789012-audigy-card.pa .include /gnu/store/12345678901234567890123456789013-other-stuff.pa [...] --8<---------------cut here---------------end--------------->8--- inside that mixed-text-file. With pulseaudio 15.0, you can also (define my-pulseaudio-extra-config (directory-union ...)) and use it like --8<---------------cut here---------------start------------->8--- (script-file (mixed-text-file "default.pa" ".include" (file-append pulseaudio "/etc/default.pa") ".include" my-pulseaudio-extra-config)) --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. Note that you are introducing extra complexity to create that directory from pulseaudio-service-type. In particular, I don't see how your solution is a notable improvement over mixed-text-file, which to me seems better suited towards this purpose. Cheers
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.