2011-07-26 01:51:56 +00:00
|
|
|
{ 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 =
|
2011-07-26 13:00:43 +00:00
|
|
|
[ pkgs.pulseaudio ];
|
2011-07-26 01:51:56 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
''
|
2011-07-26 13:00:43 +00:00
|
|
|
pcm_type.pulse {
|
|
|
|
lib ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_pcm_pulse.so
|
|
|
|
}
|
|
|
|
|
2011-07-26 01:51:56 +00:00
|
|
|
pcm.!default {
|
|
|
|
type pulse
|
|
|
|
hint.description "Default Audio Device (via PulseAudio)"
|
|
|
|
}
|
2011-07-26 13:00:43 +00:00
|
|
|
|
|
|
|
ctl_type.pulse {
|
|
|
|
lib ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_ctl_pulse.so
|
|
|
|
}
|
|
|
|
|
2011-07-26 01:51:56 +00:00
|
|
|
ctl.!default {
|
|
|
|
type pulse
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|