basic icecast

This commit is contained in:
zuckerberg 2021-05-16 11:02:24 -04:00
parent 9c4ab246d3
commit 5769daab37
2 changed files with 43 additions and 19 deletions

39
common/server/icecast.nix Normal file
View File

@ -0,0 +1,39 @@
{ lib, config, ... }:
let
cfg = config.services.icecast;
in {
options.services.icecast = {
mount = lib.mkOption {
type = lib.types.str;
example = "stream.mp3";
};
};
config = lib.mkIf cfg.enable {
listen.address = "127.0.0.1";
admin.password = "hackme";
extraConf = ''
<authentication>
<source-password>hackme</source-password>
</authentication>
<http-headers>
<header type="cors" name="Access-Control-Allow-Origin" />
</http-headers>
<mount type="normal">
<mount-name>/${cfg.mount}</mount-name>
<max-listeners>20</max-listeners>
<burst-size>65536</burst-size>
<hidden>false</hidden>
<public>false</public>
</mount>
'';
};
services.nginx.virtualHosts.${cfg.hostname} = {
enableACME = true;
forceSSL = true;
locations."/${cfg.mount}" = {
proxyPass = "http://localhost:${toString cfg.listen.port}/${cfg.mount}";
};
};
}

View File

@ -26,26 +26,11 @@
services.nginx.enable = true;
# # icecast
# services.icecast = {
# enable = true;
# hostname = "mitty.neet.dev";
# listen.port = 8000;
# admin.password = builtins.readFile /secret/icecast.password;
# };
networking.firewall.allowedTCPPorts = [ 1935 ];
services.peertube = {
# icecast
services.icecast = {
enable = true;
configFile = ./peertube.yaml;
};
services.postfix.enable = true;
services.redis.enable = true;
services.nginx.virtualHosts."mitty.neet.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:9000";
};
hostname = "mitty.neet.dev";
mount = "stream.mp3";
};
security.acme.acceptTerms = true;