Author: eelco
Date: Tue Jul 26 17:35:47 2011
New Revision: 27966
URL: https://svn.nixos.org/websvn/nix/?rev=27966&sc=1

Log:
* 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.

Modified:
   nixos/trunk/modules/config/pulseaudio.nix

Modified: nixos/trunk/modules/config/pulseaudio.nix
==============================================================================
--- nixos/trunk/modules/config/pulseaudio.nix   Tue Jul 26 15:25:21 2011        
(r27965)
+++ nixos/trunk/modules/config/pulseaudio.nix   Tue Jul 26 17:35:47 2011        
(r27966)
@@ -2,6 +2,8 @@
 
 with pkgs.lib;
 
+let cfg = config.hardware.pulseaudio; in
+
 {
 
   options = {
@@ -16,12 +18,23 @@
   };
   
 
-  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 @@
               }
             '';
         }
-      ];
+
+        { 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;
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to