Commit 658358a5488d

Vincent Demeester <vincent@sbr.pm>
2018-03-13 18:27:28
Update pulseaudio configuration and test mopidy
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent f4c4113
machine/wakasu.nix
@@ -10,6 +10,7 @@
 			../profiles/dockerization.nix
 			../profiles/dev.go.nix
 			../profiles/dev.python.nix
+			../profiles/mopidy.nix
 			../location/docker.nix
 			../location/home.nix
 			../hardware/thinkpad-t460s.nix
profiles/audio.nix
@@ -5,11 +5,15 @@
 		pulseaudio = {
 			enable = true;
 			support32Bit = true;
+			zeroconf = {
+				discovery.enable = true;
+				publish.enable = true;
+			};
+			tcp.enable = true;
 			package = pkgs.pulseaudioFull;
 		};
 	};
 	sound.mediaKeys.enable = true;
-	
 
 	# spotify
 	networking.firewall.allowedTCPPorts = [ 57621 57622 ];
profiles/mopidy.nix
@@ -0,0 +1,23 @@
+{ config, pkgs, ... }:
+
+with import ../accounts.nix;
+
+{
+  services.mopidy = {
+    enable = true;
+    extensionPackages = with pkgs; [
+      mopidy-spotify
+      mopidy-moped
+      mopidy-mopify
+    ];
+    configuration = ''
+      [spotify]
+      username = ${spotify.user}
+      password = ${spotify.password}
+      client_id = ${spotify.client_id}
+      client_secret = ${spotify.client_secret}
+      [audio]
+      output = pulsesink server=127.0.0.1
+    '';
+  };
+}
.gitignore
@@ -3,3 +3,4 @@ result
 .tramp*
 *~
 hostname
+accounts.nix
accounts.nix.example
@@ -0,0 +1,9 @@
+{
+  spotify = {
+    user = "email@address";
+    password = "password";
+    # Client ID & Secret can be created here https://www.mopidy.com/authenticate/#spotify
+    client_id = "client_id";
+    client_secret = "client_secret";
+  };
+}
\ No newline at end of file