nixos/modules/services/audio/alsa.nix: fix evaluation

https://github.com/NixOS/nixpkgs/issues/2732
This commit is contained in:
Peter Simons 2014-05-23 19:20:16 +02:00
parent 78618e12d3
commit c18775837c

View File

@ -7,10 +7,6 @@ let
inherit (pkgs) alsaUtils;
soundState = "/var/lib/alsa/asound.state";
configPath = "asound.conf";
in
{
@ -39,7 +35,7 @@ in
extraConfig = mkOption {
type = types.lines;
default = '''';
default = "";
example = ''
defaults.pcm.!card 3
'';
@ -59,10 +55,12 @@ in
environment.systemPackages = [ alsaUtils ];
environment.etc = [ { source = config.sound.extraConfig;
target = configPath;
}
];
environment.etc = mkIf (config.sound.extraConfig != "")
[
{ source = pkgs.writeText "asound.conf" config.sound.extraConfig;
target = "asound.conf";
}
];
# ALSA provides a udev rule for restoring volume settings.
services.udev.packages = [ alsaUtils ];