{ lib, config, ... }: # configures icecast to only accept source from localhost # to a audio optimized stream on services.icecast.mount # made available via nginx for http access on # https://host/mount let cfg = config.services.icecast; in { options.services.icecast = { mount = lib.mkOption { type = lib.types.str; example = "stream.mp3"; }; }; config = lib.mkIf cfg.enable { services.icecast = { listen.address = "127.0.0.1"; admin.password = "hackme"; extraConf = '' hackme
/${cfg.mount} 20 65536 false false ''; }; services.nginx.virtualHosts.${cfg.hostname} = { enableACME = true; forceSSL = true; locations."/${cfg.mount}" = { proxyPass = "http://localhost:${toString cfg.listen.port}/${cfg.mount}"; }; }; }; }