Author: eelco
Date: Tue Jul 26 01:51:56 2011
New Revision: 27958
URL: https://svn.nixos.org/websvn/nix/?rev=27958&sc=1

Log:
* Add a module to enable PulseAudio.  It causes all ALSA applications
  to be rerouted to PulseAudio.

  Note that this is distinct from the already existing module
  ‘services/audio/pulseaudio.nix’ that provides a system-wide
  PulseAudio daemon, which is usually not what you want.

Added:
   nixos/trunk/modules/config/pulseaudio.nix
Modified:
   nixos/trunk/modules/module-list.nix
   nixos/trunk/modules/services/x11/desktop-managers/kde4.nix

Added: nixos/trunk/modules/config/pulseaudio.nix
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixos/trunk/modules/config/pulseaudio.nix   Tue Jul 26 01:51:56 2011        
(r27958)
@@ -0,0 +1,47 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+{
+
+  options = {
+  
+    hardware.pulseaudio.enable = mkOption {
+      default = false;
+      description = ''
+        Whether to enable the PulseAudio sound server.
+      '';
+    };
+
+  };
+  
+
+  config = mkIf config.hardware.pulseaudio.enable {
+
+    environment.systemPackages =
+      [ pkgs.pulseaudio pkgs.alsaPlugins ];
+
+    environment.etc =
+      [ # Write an /etc/asound.conf that causes all ALSA applications to
+        # be re-routed to the PulseAudio server through ALSA's Pulse
+        # plugin.
+        { target = "asound.conf";
+          source = pkgs.writeText "asound.conf"
+            ''
+              pcm.!default {
+                type pulse
+                hint.description "Default Audio Device (via PulseAudio)"
+              }
+              ctl.!default {
+                type pulse
+              }
+            '';
+        }
+      ];
+
+    # Ensure that the ALSA Pulse plugin appears in ALSA's search path.
+    environment.pathsToLink = [ "lib/alsa-lib" ];
+
+  };
+
+}

Modified: nixos/trunk/modules/module-list.nix
==============================================================================
--- nixos/trunk/modules/module-list.nix Tue Jul 26 01:19:35 2011        (r27957)
+++ nixos/trunk/modules/module-list.nix Tue Jul 26 01:51:56 2011        (r27958)
@@ -7,6 +7,7 @@
   ./config/no-x-libs.nix
   ./config/nsswitch.nix
   ./config/power-management.nix
+  ./config/pulseaudio.nix
   ./config/shells.nix
   ./config/swap.nix
   ./config/system-path.nix

Modified: nixos/trunk/modules/services/x11/desktop-managers/kde4.nix
==============================================================================
--- nixos/trunk/modules/services/x11/desktop-managers/kde4.nix  Tue Jul 26 
01:19:35 2011        (r27957)
+++ nixos/trunk/modules/services/x11/desktop-managers/kde4.nix  Tue Jul 26 
01:51:56 2011        (r27958)
@@ -117,6 +117,11 @@
           # Phonon backends.
           pkgs.kde4.phonon_backend_gstreamer
           pkgs.gst_all.gstPluginsBase
+          pkgs.gst_all.gstPluginsGood
+          pkgs.gst_all.gstPluginsUgly
+          pkgs.gst_all.gstPluginsBad
+          pkgs.gst_all.gstFfmpeg # for mp3 playback
+          pkgs.gst_all.gstreamer # needed?
 
           # Miscellaneous runtime dependencies.
           pkgs.kde4.qt4 # needed for qdbus
@@ -138,6 +143,8 @@
     services.hal = mkIf (!isKDE47) { enable = true; };
     services.udisks = mkIf isKDE47 { enable = true; };
     services.upower = mkIf isKDE47 { enable = true; };
+
+    hardware.pulseaudio = mkIf isKDE47 { enable = true; };
     
   };
 
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to