7bdaedb465
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. svn path=/nixos/trunk/; revision=27958
48 lines
1 KiB
Nix
48 lines
1 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 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" ];
|
|
|
|
};
|
|
|
|
}
|