aboutsummaryrefslogblamecommitdiff
path: root/profiles/media.nix
blob: 598eaa29815be1ad0110d2fd6e26a5297d49296f (plain) (tree)







































                                                
{ 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;
      }
    ];
  };
}