Leo,
Leo Prikler <leo.prikler@student.tugraz.at> writes:
Toggle quote (21 lines)
> Hi Guix,
>
> After looking at my older patch (which no longer cleanly applies), I've
> noticed, that pulseaudio doesn't even read the files from /etc. This
> is troublesome in multiple ways. For one, pulseaudio causes >500
> rebuilds (with >900 dependent packages) and is therefore staging
> material, for the other, hardcoding /etc in such a way breaks
> pulseaudio without the service.
>
> So far, I've only tested containers via `guix environment --container`,
> but from what I can gather with strace, the config file is indeed read
> and hence flat-volumes are eliminated. Other ways of making pulseaudio
> accept /etc are very welcome. Looking at Nix, they configure
> pulseaudio with "--sysconfdir=/etc", but then override sysconfdir and
> pulseconfdir during install. I'm not quite sure which solution is
> "better", but neither is going to read the config shipped with the
> package.
>
> Note: before this can be applied on staging,
> a66ee82a05d8ff1ef7c5ff9ac7723cb32fc4e22a needs to be applied.
Thank you for these patches. Overall it LGTM.
[...]
Toggle quote (9 lines)
> From bf4708923d14356c87daec69209b30aa0427d64f Mon Sep 17 00:00:00 2001
> From: Leo Prikler <leo.prikler@student.tugraz.at>
> Date: Wed, 8 Jan 2020 19:50:51 +0100
> Subject: [PATCH 1/3] services: Add pulseaudio-configuration.
>
> * gnu/services/sound (<pulseaudio-configuration>): New record.
> (pulseaudio-etc): New procedure.
> (pulseaudio-service-type): Update accordingly.
Toggle quote (7 lines)
> +(define-record-type* <pulseaudio-configuration>
> + pulseaudio-configuration make-pulseaudio-configuration
> + pulseaudio-configuration?
> + (package pulseaudio-package (default pulseaudio))
> + (client-conf pulseaudio-client-conf (default '()))
> + (daemon-conf pulseaudio-daemon-conf (default '((flat-volumes no))))
I have a preference for making this field empty initially to have a 1:1
compatibility with the current PA client and daemon configuration
(i.e. nothing). Then a follow-up patch can add this new configuration,
perhaps with an explaining comment.
Toggle quote (42 lines)
> + (default-script pulseaudio-default-script (default #f))
> + (system-script pulseaudio-system-script (default #f)))
> +
> (define (pulseaudio-environment config)
> ;; Define this variable in the global environment such that
> ;; pulseaudio swh-plugins works.
> `(("LADSPA_PATH"
> . ,(file-append swh-plugins "/lib/ladspa"))))
>
> +(define (pulseaudio-conf-entry arg)
> + (match arg
> + ((key value)
> + (format #f "~a = ~s~%" key value))
> + ((? string? _)
> + (string-append arg "\n"))))
> +
> +(define pulseaudio-etc
> + (match-lambda
> + (($ <pulseaudio-configuration> package client-conf daemon-conf
> + default-script system-script)
> + (let ((default.pa (if default-script
> + (apply mixed-text-file "default.pa"
> + default-script)
> + (file-append package "/etc/pulse/default.pa"))))
> + `(("pulse"
> + ,(file-union
> + "pulse"
> + `(("client.conf"
> + ,(apply mixed-text-file "client.conf"
> + (map pulseaudio-conf-entry client-conf)))
> + ("daemon.conf"
> + ,(apply mixed-text-file "daemon.conf"
> + "default-script-file = " default.pa "\n"
> + (map pulseaudio-conf-entry daemon-conf)))
> + ("default.pa" ,default.pa)
> + ("system.pa"
> + ,(if system-script
> + (apply mixed-text-file "system.pa"
> + system-script)
> + (file-append package "/etc/pulse/system.pa")))))))))))
> +
Does it make sense to have default-script and system-script default to
(file-append pulseaudio "...") and avoid the conditional altogether?
[...]
Toggle quote (8 lines)
> From 843d3968db990b5b7ff3f618db5847f83b999cb8 Mon Sep 17 00:00:00 2001
> From: Leo Prikler <leo.prikler@student.tugraz.at>
> Date: Thu, 9 Jan 2020 01:24:09 +0100
> Subject: [PATCH 2/3] gnu: pulseaudio: Honor /etc.
>
> * gnu/packages/pulseaudio.scm (pulseaudio) [phases]:
> Set PA_DEFAULT_CONFIG_DIR to "/etc/pulse".
This means pulseaudio will start looking in /etc/pulse for configuration
files on foreign distributions too, right?
I wonder if there is better way to give it configuration files. Perhaps
by patching the D-Bus service files? Not a blocker for this series, but
something to consider in case /etc/pulse causes trouble.
[...]
Toggle quote (6 lines)
> + (add-after 'configure 'hardcode-default-config-dir
> + (lambda _
> + (substitute* "config.h"
> + (("(#define PA_DEFAULT_CONFIG_DIR).*$" all prefix)
> + (string-append prefix " \"/etc/pulse\"")))))
Toggle quote (7 lines)
> From e24016f9a44a113847dd937ac47ab4bdb960236d Mon Sep 17 00:00:00 2001
> From: Leo Prikler <leo.prikler@student.tugraz.at>
> Date: Thu, 9 Jan 2020 01:29:13 +0100
> Subject: [PATCH 3/3] services: Add pulseaudio to %desktop-services.
>
> * gnu/services/desktop.scm (%desktop-services): Add pulseaudio service.
This will pull in "swh-plugins" which was the original intention behind
pulseaudio-service before this patch series. Before adding it to
%desktop-services, I would prefer if the pulseaudio environment
configuration could be made modular, so that there are no configuration
differences for end users, i.e. they'd have to actively enable the
LADSPA plugin.
I'm not sure what the best approach would be though. Ideas, Oleg?
As a final note, can you also update doc/guix.texi accordingly?
TIA,
Marius