catarina: split radio services to containers + new radio station

This commit is contained in:
L-Nafaryus 2024-09-22 19:47:46 +05:00
parent 484529aaa2
commit 70f47e2f75
Signed by: L-Nafaryus
GPG Key ID: 553C97999B363D38

View File

@ -1,7 +1,17 @@
{config, ...}: { {config, ...}: {
containers.radio-synthwave = { containers = {
radio-synthwave = {
autoStart = true; autoStart = true;
privateNetwork = true; privateNetwork = true;
hostAddress = "10.231.136.1";
localAddress = "10.231.136.2";
bindMounts = {
"/var/lib/music" = {
hostPath = "/home/l-nafaryus/Music";
isReadOnly = true;
};
};
config = { config = {
config, config,
@ -11,17 +21,16 @@
}: { }: {
services.mpd = { services.mpd = {
enable = true; enable = true;
musicDirectory = "/home/l-nafaryus/Music"; musicDirectory = "/var/lib/music";
network.listenAddress = "any"; network.listenAddress = "any";
#network.startWhenNeeded = true; #network.startWhenNeeded = true;
user = "l-nafaryus"; user = "mpd";
network.port = 6600; network.port = 6600;
extraConfig = '' extraConfig = ''
audio_output { audio_output {
type "httpd" type "httpd"
name "Radio" name "Radio"
port "6660" port "6660"
bind_to_address "127.0.0.1"
encoder "lame" encoder "lame"
max_clients "0" max_clients "0"
website "https://radio.elnafo.ru/synthwave" website "https://radio.elnafo.ru/synthwave"
@ -42,11 +51,62 @@
}; };
}; };
radio-non-stop = {
autoStart = true;
privateNetwork = true;
hostAddress = "10.231.136.1";
localAddress = "10.231.136.3";
bindMounts = {
"/var/lib/music" = {
hostPath = "/home/l-nafaryus/Music";
isReadOnly = true;
};
};
config = {
config,
pkgs,
lib,
...
}: {
services.mpd = {
enable = true;
musicDirectory = "/var/lib/music";
network.listenAddress = "any";
#network.startWhenNeeded = true;
user = "mpd";
network.port = 6601;
extraConfig = ''
audio_output {
type "httpd"
name "Radio"
port "6661"
encoder "lame"
max_clients "0"
website "https://radio.elnafo.ru/non-stop"
always_on "yes"
tags "yes"
bitrate "128"
format "44100:16:1"
}
'';
};
system.stateVersion = "24.05";
networking.firewall = {
enable = true;
allowedTCPPorts = [6601 6661];
};
};
};
};
services.nginx.virtualHosts."radio.elnafo.ru" = { services.nginx.virtualHosts."radio.elnafo.ru" = {
forceSSL = true; forceSSL = true;
useACMEHost = "elnafo.ru"; useACMEHost = "elnafo.ru";
locations."/synthwave".proxyPass = "http://127.0.0.1:6660"; locations."/synthwave".proxyPass = "http://10.231.136.2:6660";
locations."/non-stop".proxyPass = "http://10.231.136.3:6661";
}; };
networking.firewall.allowedTCPPorts = [6600];
} }