{ pkgs, config, ... }:
{
imports = [
./nginx
];
services = {
icecast = {
enable = true;
listen.port = 265;
hostname = "icecast.${config.domains.jim1}";
admin = {
user = "jimbo";
password = "${config.secrets.castAdminPass}";
};
extraConf = ''
${config.secrets.castSourcePass}
Canada
jimbo@${config.domains.jim2}
/jimbops.opus
JimBops Radio
Music gathered by me, Jimbo.
https://icecast.jimbosfiles.com/jimbops.opus
Anything
application/ogg
vorbis
'';
};
# The audio stream
liquidsoap.streams = {
jimbops = pkgs.writeText "liquidjim" ''
settings.log.stdout.set(true)
settings.init.allow_root.set(true)
settings.scheduler.fast_queues.set(2)
settings.decoder.file_extensions.mp4.set(["m4a", "m4b", "m4p", "m4v", "m4r", "3gp", "mp4"])
# Define the source with random playlist
jimbops = mksafe(playlist(mode='randomize', reload=1, reload_mode="rounds", "/export/JimboNFS/Music/"))
# Ensure the stream never stops
jimbops_fallback = fallback([jimbops, jimbops])
# Output configuration to Icecast
output.icecast(
%ffmpeg(format="ogg", %audio(codec="libvorbis", samplerate=48000, b="256k", channels=2)),
host="127.0.0.1",
port=265,
password="${config.secrets.castSourcePass}",
public=true,
icy_metadata=["artist", "title"],
mount="jimbops.opus",
encoding = "UTF-8",
jimbops_fallback
)
'';
};
};
}