* ALSA support: save/restore the volume settings, create device nodes
in /dev/snd. svn path=/nixos/trunk/; revision=8124
This commit is contained in:
parent
a177575779
commit
ba56551986
@ -749,4 +749,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
name = ["sound" "enable"];
|
||||||
|
default = true;
|
||||||
|
description = "
|
||||||
|
Whether to enable ALSA sound.
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -197,7 +197,8 @@ rec {
|
|||||||
nixosRebuild
|
nixosRebuild
|
||||||
nixosCheckout
|
nixosCheckout
|
||||||
setuidWrapper
|
setuidWrapper
|
||||||
];
|
]
|
||||||
|
++ (if config.get ["sound" "enable"] then [pkgs.alsaUtils] else []);
|
||||||
|
|
||||||
|
|
||||||
# We don't want to put all of `startPath' and `path' in $PATH, since
|
# We don't want to put all of `startPath' and `path' in $PATH, since
|
||||||
|
@ -131,6 +131,12 @@ import ../upstart-jobs/gather.nix {
|
|||||||
inherit (pkgs) glibc pwdutils;
|
inherit (pkgs) glibc pwdutils;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# ALSA sound support.
|
||||||
|
++ optional ["sound" "enable"]
|
||||||
|
(import ../upstart-jobs/alsa.nix {
|
||||||
|
inherit (pkgs) kernel module_init_tools alsaUtils;
|
||||||
|
})
|
||||||
|
|
||||||
# Handles the reboot/halt events.
|
# Handles the reboot/halt events.
|
||||||
++ (map
|
++ (map
|
||||||
(event: makeJob (import ../upstart-jobs/halt.nix {
|
(event: makeJob (import ../upstart-jobs/halt.nix {
|
||||||
|
38
upstart-jobs/alsa.nix
Normal file
38
upstart-jobs/alsa.nix
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{kernel, module_init_tools, alsaUtils}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
soundState = "/var/state/asound.state";
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "alsa";
|
||||||
|
|
||||||
|
job = "
|
||||||
|
start on hardware-scan
|
||||||
|
stop on shutdown
|
||||||
|
|
||||||
|
script
|
||||||
|
|
||||||
|
# Load some additional modules.
|
||||||
|
export MODULE_DIR=${kernel}/lib/modules/
|
||||||
|
for mod in snd_pcm_oss; do
|
||||||
|
${module_init_tools}/sbin/modprobe $mod || true
|
||||||
|
done
|
||||||
|
|
||||||
|
# Restore the sound state.
|
||||||
|
${alsaUtils}/sbin/alsactl -f ${soundState} restore
|
||||||
|
|
||||||
|
end script
|
||||||
|
|
||||||
|
stop script
|
||||||
|
|
||||||
|
# Save the sound state.
|
||||||
|
${alsaUtils}/sbin/alsactl -f ${soundState} store
|
||||||
|
|
||||||
|
end script
|
||||||
|
|
||||||
|
";
|
||||||
|
|
||||||
|
}
|
@ -28,3 +28,12 @@ KERNEL=="uinput", NAME="input/%k", MODE="0600"
|
|||||||
|
|
||||||
# Create a symlink for the CD-ROM device.
|
# Create a symlink for the CD-ROM device.
|
||||||
KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom cdrom-%k"
|
KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom cdrom-%k"
|
||||||
|
|
||||||
|
|
||||||
|
# ALSA sound devices.
|
||||||
|
KERNEL=="controlC[0-9]*", NAME="snd/%k"
|
||||||
|
KERNEL=="hwC[D0-9]*", NAME="snd/%k"
|
||||||
|
KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k"
|
||||||
|
KERNEL=="midiC[D0-9]*", NAME="snd/%k"
|
||||||
|
KERNEL=="timer", NAME="snd/%k"
|
||||||
|
KERNEL=="seq", NAME="snd/%k"
|
||||||
|
Loading…
Reference in New Issue
Block a user