2007-03-04 02:16:24 +01:00
|
|
|
{modprobe, alsaUtils}:
|
2007-03-01 01:36:00 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2007-03-20 12:04:45 +01:00
|
|
|
soundState = "/var/lib/alsa/asound.state";
|
2007-03-01 01:36:00 +01:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "alsa";
|
2007-03-06 01:07:00 +01:00
|
|
|
|
|
|
|
extraPath = [alsaUtils];
|
2007-06-10 22:17:51 +02:00
|
|
|
|
|
|
|
# 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;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
job = ''
|
|
|
|
start on udev
|
|
|
|
stop on shutdown
|
2007-03-01 01:36:00 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
start script
|
2007-03-01 01:36:00 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
mkdir -m 0755 -p $(dirname ${soundState})
|
2007-03-20 12:04:45 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
# Load some additional modules.
|
|
|
|
for mod in snd_pcm_oss; do
|
|
|
|
${modprobe}/sbin/modprobe $mod || true
|
|
|
|
done
|
2007-03-01 01:36:00 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
# Restore the sound state.
|
|
|
|
${alsaUtils}/sbin/alsactl -f ${soundState} restore
|
2007-03-01 01:36:00 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
end script
|
2007-03-01 01:36:00 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
respawn sleep 1000000 # !!! hack
|
2007-03-01 01:50:17 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
stop script
|
2007-03-01 01:36:00 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
# Save the sound state.
|
|
|
|
${alsaUtils}/sbin/alsactl -f ${soundState} store
|
2007-03-01 01:36:00 +01:00
|
|
|
|
2008-07-02 23:19:04 +02:00
|
|
|
end script
|
|
|
|
'';
|
2007-03-01 01:36:00 +01:00
|
|
|
|
|
|
|
}
|