mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-18 03:34:58 +00:00
573877c1ac
modprobe. * Move the implementation of boot.kernelModules from the udev job to the activation script. This prevents races with the udev job. * Drop references to the "capability" kernel module, which no longer exists. svn path=/nixos/trunk/; revision=33208
71 lines
1.2 KiB
Nix
71 lines
1.2 KiB
Nix
# ALSA sound support.
|
|
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
|
|
inherit (pkgs) alsaUtils;
|
|
|
|
soundState = "/var/lib/alsa/asound.state";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
sound = {
|
|
|
|
enable = mkOption {
|
|
default = true;
|
|
description = ''
|
|
Whether to enable ALSA sound.
|
|
'';
|
|
merge = mergeEnableOption;
|
|
};
|
|
|
|
enableOSSEmulation = mkOption {
|
|
default = true;
|
|
description = ''
|
|
Whether to enable ALSA OSS emulation (with certain cards sound mixing may not work!).
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf config.sound.enable {
|
|
|
|
environment.systemPackages = [ alsaUtils ];
|
|
|
|
boot.kernelModules = optional config.sound.enableOSSEmulation "snd_pcm_oss";
|
|
|
|
jobs.alsa =
|
|
{ startOn = "stopped udevtrigger";
|
|
|
|
preStart =
|
|
''
|
|
mkdir -m 0755 -p $(dirname ${soundState})
|
|
|
|
# Restore the sound state.
|
|
${alsaUtils}/sbin/alsactl -f ${soundState} restore || true
|
|
'';
|
|
|
|
postStop =
|
|
''
|
|
# Save the sound state.
|
|
${alsaUtils}/sbin/alsactl -f ${soundState} store
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
}
|