summary refs log tree commit diff
path: root/nixos/tests/mpd.nix
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2019-11-13 16:41:36 +0100
committerFranz Pletz <fpletz@fnordicwalking.de>2019-11-13 16:44:44 +0100
commit4d9899ef13aafeb66c3a3d02948966430448ccfe (patch)
treede4e5805bb17246f7b2b139a0913cc1a17e9d4bd /nixos/tests/mpd.nix
parent1eea0f52b876808893120f016b5165a43a74c9a2 (diff)
downloadnixpkgs-4d9899ef13aafeb66c3a3d02948966430448ccfe.tar
nixpkgs-4d9899ef13aafeb66c3a3d02948966430448ccfe.tar.gz
nixpkgs-4d9899ef13aafeb66c3a3d02948966430448ccfe.tar.bz2
nixpkgs-4d9899ef13aafeb66c3a3d02948966430448ccfe.tar.lz
nixpkgs-4d9899ef13aafeb66c3a3d02948966430448ccfe.tar.xz
nixpkgs-4d9899ef13aafeb66c3a3d02948966430448ccfe.tar.zst
nixpkgs-4d9899ef13aafeb66c3a3d02948966430448ccfe.zip
nixos/tests: fix mpd test
Diffstat (limited to 'nixos/tests/mpd.nix')
-rw-r--r--nixos/tests/mpd.nix70
1 files changed, 42 insertions, 28 deletions
diff --git a/nixos/tests/mpd.nix b/nixos/tests/mpd.nix
index ac2b810defe..a992576808d 100644
--- a/nixos/tests/mpd.nix
+++ b/nixos/tests/mpd.nix
@@ -1,4 +1,4 @@
-import ./make-test.nix ({ pkgs, ... }:
+import ./make-test.nix ({ pkgs, lib, ... }:
   let
     track = pkgs.fetchurl {
       # Sourced from http://freemusicarchive.org/music/Blue_Wave_Theory/Surf_Music_Month_Challenge/Skyhawk_Beach_fade_in
@@ -46,38 +46,51 @@ import ./make-test.nix ({ pkgs, ... }:
     };
 
   nodes =
-    { client = 
+    { client =
       { ... }: { };
 
       serverALSA =
-        { ... }: (mkServer {
-          mpd = defaultMpdCfg // {
-            network.listenAddress = "any";
-            extraConfig = ''
-              audio_output {
-                type "alsa"
-                name "ALSA"
-                mixer_type "null"
-              }
-            '';
-          };
-
-          musicService = with defaultMpdCfg; musicService { inherit user group musicDirectory; };
-        }) // { networking.firewall.allowedTCPPorts = [ 6600 ]; };
+        { ... }: lib.mkMerge [
+          (mkServer {
+            mpd = defaultMpdCfg // {
+              network.listenAddress = "any";
+              extraConfig = ''
+                audio_output {
+                  type "alsa"
+                  name "ALSA"
+                  mixer_type "null"
+                }
+              '';
+            };
+            musicService = with defaultMpdCfg; musicService { inherit user group musicDirectory; };
+          })
+          { networking.firewall.allowedTCPPorts = [ 6600 ]; }
+        ];
 
       serverPulseAudio =
-        { ... }: (mkServer {
-          mpd = defaultMpdCfg // {
-            extraConfig = ''
-              audio_output {
-                type "pulse"
-                name "The Pulse"
-              }
-            '';
-          };
-
-          musicService = with defaultCfg; musicService { inherit user group musicDirectory; };
-        }) // { hardware.pulseaudio.enable = true; };
+        { ... }: lib.mkMerge [
+          (mkServer {
+            mpd = defaultMpdCfg // {
+              extraConfig = ''
+                audio_output {
+                  type "pulse"
+                  name "The Pulse"
+                }
+              '';
+            };
+
+            musicService = with defaultCfg; musicService { inherit user group musicDirectory; };
+          })
+          {
+            hardware.pulseaudio = {
+              enable = true;
+              systemWide = true;
+              tcp.enable = true;
+              tcp.anonymousClients.allowAll = true;
+            };
+            systemd.services.mpd.environment.PULSE_SERVER = "localhost";
+          }
+        ];
     };
 
   testScript = ''
@@ -110,6 +123,7 @@ import ./make-test.nix ({ pkgs, ... }:
     play_some_music($serverALSA);
     play_some_music($serverPulseAudio);
 
+    $client->waitForUnit("multi-user.target");
     $client->succeed("$mpc -h serverALSA status");
 
     # The PulseAudio-based server is configured not to accept external client connections