nixos-config/modules/system/services/server/icecast/liquidsoap/nixscrap/default.nix

39 lines
1.2 KiB
Nix
Raw Normal View History

2025-02-25 01:37:56 -05:00
{ config, lib, pkgs, ... }:
{
2025-01-01 16:54:27 -05:00
config = lib.mkIf config.services.icecast.enable {
2025-01-16 00:41:00 -05:00
services.liquidsoap.streams = {
2025-03-03 01:36:06 -05:00
nixscrap = pkgs.writeText "nixscrap" ''
2025-01-01 16:54:27 -05:00
settings.log.stdout.set(true)
settings.init.allow_root.set(true)
settings.scheduler.fast_queues.set(2)
2025-03-03 01:36:06 -05:00
stream = mksafe(playlist(mode='randomize', reload=1, reload_mode="rounds", "/export/KittyNFS/Music/Scrap"))
2025-02-25 03:44:13 -05:00
stream_fallback = fallback([stream, stream])
2025-01-01 16:54:27 -05:00
output.icecast(
%ffmpeg(format="ogg", %audio(codec="libvorbis", samplerate=48000, b="256k", channels=2)),
host="127.0.0.1",
2025-01-16 00:41:00 -05:00
port=${toString config.services.icecast.listen.port},
2025-01-01 16:54:27 -05:00
password="${config.secrets.castSourcePass}",
encoding = "UTF-8",
2025-03-03 01:36:06 -05:00
name="Nixbops Scrap",
2025-01-01 16:54:27 -05:00
genre="Scrapped",
description="Music canned from the main radio.",
2025-03-03 01:36:06 -05:00
mount="nixscrap.opus",
2025-01-01 16:54:27 -05:00
icy_metadata=["artist", "title"],
public=true,
2025-02-25 03:44:13 -05:00
stream_fallback
2025-01-01 16:54:27 -05:00
)
'';
};
# Avoid the most stupid error imaginable
2025-03-03 01:36:06 -05:00
systemd.services.nixscrap = {
2025-01-01 16:54:27 -05:00
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
};
2024-12-22 22:02:10 -05:00
};
}