mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 01:23:03 +00:00
5f60393ffe
makes the `hardware-scan' job unnecessary. (In fact the new approach appears to be more thorough; it loads some drivers that were not previously loaded.) svn path=/nixos/trunk/; revision=12248
51 lines
884 B
Nix
51 lines
884 B
Nix
{modprobe, alsaUtils}:
|
|
|
|
let
|
|
|
|
soundState = "/var/lib/alsa/asound.state";
|
|
|
|
in
|
|
|
|
{
|
|
name = "alsa";
|
|
|
|
extraPath = [alsaUtils];
|
|
|
|
# Alsalib seems to require the existence of this group, even if it's
|
|
# not used (e.g., doesn't own any devices).
|
|
groups = [
|
|
{ name = "audio";
|
|
gid = (import ../system/ids.nix).gids.audio;
|
|
}
|
|
];
|
|
|
|
job = ''
|
|
start on udev
|
|
stop on shutdown
|
|
|
|
start script
|
|
|
|
mkdir -m 0755 -p $(dirname ${soundState})
|
|
|
|
# Load some additional modules.
|
|
for mod in snd_pcm_oss; do
|
|
${modprobe}/sbin/modprobe $mod || true
|
|
done
|
|
|
|
# Restore the sound state.
|
|
${alsaUtils}/sbin/alsactl -f ${soundState} restore
|
|
|
|
end script
|
|
|
|
respawn sleep 1000000 # !!! hack
|
|
|
|
stop script
|
|
|
|
# Save the sound state.
|
|
${alsaUtils}/sbin/alsactl -f ${soundState} store
|
|
|
|
end script
|
|
'';
|
|
|
|
}
|