nixfiles/hosts/hetzner-vm/services/mpd.nix

60 lines
1.4 KiB
Nix
Raw Normal View History

2022-01-24 21:18:03 +00:00
{ pkgs, lib, ... }: {
environment.systemPackages = with pkgs; [ mpc_cli ];
sound.enable = true;
hardware.pulseaudio = {
systemWide = true;
enable = true;
};
2022-01-23 10:30:56 +00:00
services.mpd = {
enable = true;
network.listenAddress = "0.0.0.0";
dataDir = "/mpd";
musicDirectory = "/storage/music";
playlistDirectory = "/mpd/playlists";
credentials = [{
passwordFile = "/secrets/mpd-password";
permissions = [ "read" "add" "control" "admin" ];
}];
extraConfig = ''
host_permissions "127.0.0.1 read,add,control,admin"
2022-01-23 10:30:56 +00:00
samplerate_converter "1"
audio_output_format "44100:16:2"
audio_output {
type "httpd"
name "HTTP Music Out"
encoder "opus"
port "8012"
bitrate "64000"
2022-01-23 10:30:56 +00:00
format "48000:16:2"
always_on "yes"
tags "yes"
}
2022-01-24 21:18:03 +00:00
audio_output {
type "pulse"
name "Out"
server "lappy.tailscale-internal.genderfucked.monster"
}
2022-01-23 10:30:56 +00:00
'';
};
systemd.services.mpd.serviceConfig.StateDirectory = [ "/mpd" ];
2022-01-23 10:30:56 +00:00
services.nginx.virtualHosts."stream.owo.monster" = {
forceSSL = true;
enableACME = true;
locations = {
"/" = {
proxyPass = "http://127.0.0.1:8012";
extraConfig = ''
auth_basic "Music Password";
auth_basic_user_file /secrets/music-stream-passwd;
'';
};
};
2022-01-23 10:30:56 +00:00
};
networking.firewall.allowedTCPPorts = [ 6600 ];
}