From 77c85b1de749879b6ff302168391d4b6641df8a1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 26 Jul 2011 17:35:47 +0000 Subject: [PATCH] * Install /etc/pulse/default.pa and /etc/pulse/system.pa. * If PulseAudio is disabled in the NixOS config, then disable autospawning of the PulseAudio server in /etc/pulse/client.conf. svn path=/nixos/trunk/; revision=27966 --- modules/config/pulseaudio.nix | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/modules/config/pulseaudio.nix b/modules/config/pulseaudio.nix index 35b7cbb01582..8f2227461b52 100644 --- a/modules/config/pulseaudio.nix +++ b/modules/config/pulseaudio.nix @@ -2,6 +2,8 @@ with pkgs.lib; +let cfg = config.hardware.pulseaudio; in + { options = { @@ -16,12 +18,23 @@ with pkgs.lib; }; - config = mkIf config.hardware.pulseaudio.enable { + config = mkIf cfg.enable { environment.systemPackages = [ pkgs.pulseaudio ]; - environment.etc = + environment.etc = mkAlways ( + [ # Create pulse/client.conf even if PulseAudio is disabled so + # that we can disable the autospawn feature in programs that + # are built with PulseAudio support (like KDE). + { target = "pulse/client.conf"; + source = pkgs.writeText "client.conf" + '' + autospawn=${if cfg.enable then "yes" else "no"} + ''; + } + + ] ++ optionals cfg.enable [ # Write an /etc/asound.conf that causes all ALSA applications to # be re-routed to the PulseAudio server through ALSA's Pulse # plugin. @@ -46,7 +59,16 @@ with pkgs.lib; } ''; } - ]; + + { target = "pulse/default.pa"; + source = "${pkgs.pulseaudio}/etc/pulse/default.pa"; + } + + { target = "pulse/system.pa"; + source = "${pkgs.pulseaudio}/etc/pulse/system.pa"; + } + + ]); # Allow PulseAudio to get realtime priority using rtkit. security.rtkit.enable = true;