about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2014-05-23 19:20:16 +0200
committerPeter Simons <simons@cryp.to>2014-05-23 19:20:49 +0200
commitc18775837cf7122e2448539b738beea62c96af1e (patch)
tree2e9d9a65851ce79408c9f960b8aac1a149d6c71c /nixos/modules/services
parent78618e12d39d1088f0eb6ae647e731d3cd23ab33 (diff)
downloadnixlib-c18775837cf7122e2448539b738beea62c96af1e.tar
nixlib-c18775837cf7122e2448539b738beea62c96af1e.tar.gz
nixlib-c18775837cf7122e2448539b738beea62c96af1e.tar.bz2
nixlib-c18775837cf7122e2448539b738beea62c96af1e.tar.lz
nixlib-c18775837cf7122e2448539b738beea62c96af1e.tar.xz
nixlib-c18775837cf7122e2448539b738beea62c96af1e.tar.zst
nixlib-c18775837cf7122e2448539b738beea62c96af1e.zip
nixos/modules/services/audio/alsa.nix: fix evaluation
https://github.com/NixOS/nixpkgs/issues/2732
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/audio/alsa.nix16
1 files changed, 7 insertions, 9 deletions
diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix
index d49c2676f7df..653c0ed5d70b 100644
--- a/nixos/modules/services/audio/alsa.nix
+++ b/nixos/modules/services/audio/alsa.nix
@@ -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 ];