I found out that NixOS unstable removed the sound option. Also, the NixOS Wiki says that ALSA can be enabled with sound.enable = true;. How do I do that now?
Does the release note section help?
sound options removal
The sound options have been largely removed, as they are unnecessary for most modern setups, and cause issues when enabled.
If you set sound.enable in your configuration:
If you are using Pulseaudio or PipeWire, simply remove that option
If you are not using an external sound server, and want volumes to be persisted across shutdowns, set hardware.alsa.enablePersistence = true instead
If you set sound.enableOSSEmulation in your configuration:
Make sure it is still necessary, as very few applications actually use OSS
If necessary, set boot.kernelModules = [ "snd_pcm_oss" ]
If you set sound.extraConfig in your configuration:
If you are using another sound server, like Pulseaudio, JACK or PipeWire, migrate your configuration to that
If you are not using an external sound server, set environment.etc."asound.conf".text = yourExtraConfig instead
If you set sound.mediaKeys in your configuration:
Preferably switch to handling media keys in your desktop environment/compositor
If you want to maintain the exact behavior of the option, use the following snippet
services.actkbd = let
volumeStep = "1%";
in {
enable = true;
bindings = [
# "Mute" media key
{ keys = [ 113 ]; events = [ "key" ]; command = "${alsa-utils}/bin/amixer -q set Master toggle"; }
# "Lower Volume" media key
{ keys = [ 114 ]; events = [ "key" "rep" ]; command = "${alsa-utils}/bin/amixer -q set Master ${volumeStep}- unmute"; }
# "Raise Volume" media key
{ keys = [ 115 ]; events = [ "key" "rep" ]; command = "${alsa-utils}/bin/amixer -q set Master ${volumeStep}+ unmute"; }
# "Mic Mute" media key
{ keys = [ 190 ]; events = [ "key" ]; command = "${alsa-utils}/bin/amixer -q set Capture toggle"; }
];
};
1 Like
Thank you! hardware.alsa.enablePersistence - what I was looking for
1 Like