nixpkgs/modules/config/pulseaudio.nix
Eelco Dolstra 8bf3c2c1bf * The implementation of the ALSA_PLUGIN_DIRS variable is buggy:
because it uses strtok() to modify the environment variable in
  place, it only works correctly the first time it's called.
  Subsequent calls only see the first directory listed in the
  variable.  This causes applications such as Audacious to fail
  because the Pulse plugin is not in the first directory.  However, we
  don't actually need $ALSA_PLUGIN_DIRS, because /etc/asound.conf
  allows the full path to the Pulse plugin to be specified.

svn path=/nixos/trunk/; revision=27960
2011-07-26 13:00:43 +00:00

54 lines
1.2 KiB
Nix

{ 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 ];
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_type.pulse {
lib ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_pcm_pulse.so
}
pcm.!default {
type pulse
hint.description "Default Audio Device (via PulseAudio)"
}
ctl_type.pulse {
lib ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_ctl_pulse.so
}
ctl.!default {
type pulse
}
'';
}
];
};
}