aboutsummaryrefslogtreecommitdiff
path: root/profiles/media.nix
blob: 598eaa29815be1ad0110d2fd6e26a5297d49296f (plain) (blame)
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
32
33
34
35
36
37
38
39
40
{ config, ... }:
{
  services.mpd = {
    enable = true;
    network = {
      listenAddress = "0.0.0.0";
      port = 6600;
    };
    musicDirectory = "/data/media/music";
    extraConfig = ''
      auto_update "yes"
      auto_update_depth "3"
      audio_output {
        type "httpd"
        name "HTTP Stream"
        encoder "opus"
        port "8000"
        bitrate "128000"
        format "48000:16:2"
        always_on "yes"
        tags "yes"
      }
    '';
  };

  networking.firewall.allowedTCPPorts = [
    6600
    8000
  ];

  environment.persistence."/persist/save" = {
    directories = [
      {
        directory = config.services.mpd.dataDir;
        user = config.services.mpd.user;
        group = config.services.mpd.group;
      }
    ];
  };
}