From 5769daab37fc71c03bb06643de5d2f62c024e342 Mon Sep 17 00:00:00 2001 From: zuckerberg <5-zuckerberg@users.noreply.git.neet.dev> Date: Sun, 16 May 2021 11:02:24 -0400 Subject: [PATCH] basic icecast --- common/server/icecast.nix | 39 ++++++++++++++++++++++++++++++++ machines/mitty/configuration.nix | 23 ++++--------------- 2 files changed, 43 insertions(+), 19 deletions(-) create mode 100644 common/server/icecast.nix diff --git a/common/server/icecast.nix b/common/server/icecast.nix new file mode 100644 index 0000000..9344282 --- /dev/null +++ b/common/server/icecast.nix @@ -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 = '' + + 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}"; + }; + }; +} diff --git a/machines/mitty/configuration.nix b/machines/mitty/configuration.nix index 95719af..3c5e273 100644 --- a/machines/mitty/configuration.nix +++ b/machines/mitty/configuration.nix @@ -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;