summaryrefslogtreecommitdiff
path: root/config/mpd.nix
blob: a9dcee06831746f786d2aa3e2098c289bcf74cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ config, lib, pkgs, ... }:
let
  mpdport = (import ../data/aliases.nix).services.mpd.port;
  mpdwebport = (import ../data/aliases.nix).services.mpdweb.port;
in {
  networking.firewall.allowedTCPPorts = [ mpdport mpdwebport ];

  services.ympd = {
    enable = true;
    webPort = toString mpdwebport;
  };

  services.mpd = {
    enable = true;
    musicDirectory = "/storage/music";
    extraConfig = ''
              audio_output {
              	type		"httpd"
              	name		"KJ mpd stream"
              	encoder		"lame"
              	port		"${toString mpdport}"
              	quality		"0"			# do not define if bitrate is defined
              	#bitrate		"128"			# do not define if quality is defined
              	format		"44100:16:1"
              	always_on       "yes"			# prevent MPD from disconnecting all listeners when playback is stopped.
              	tags            "yes"			# httpd supports sending tags to listening streams.
      		audio_buffer_size "8192"
              }
    '';
  };
}