From 3e39e00ee7d3023219f75d9164232a5cde187aeb Mon Sep 17 00:00:00 2001 From: Max Audron Date: Fri, 29 Mar 2024 13:55:03 +0100 Subject: add rtmp and laplace --- modules/rtmp/default.nix | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 modules/rtmp/default.nix (limited to 'modules/rtmp/default.nix') diff --git a/modules/rtmp/default.nix b/modules/rtmp/default.nix new file mode 100644 index 0000000..a9dcb15 --- /dev/null +++ b/modules/rtmp/default.nix @@ -0,0 +1,65 @@ +{ config, lib, pkgs, ... }: + +{ + systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www" ]; + services.nginx = { + additionalModules = [ pkgs.nginxModules.rtmp ]; + + appendConfig = '' + rtmp { + server { + listen 1935; + chunk_size 512; + application live { + live on; + record off; + hls on; + hls_path /var/www/stream.vapor.systems/hls; + # hls_fragment 3; + # hls_playlist_length 60; + dash on; + dash_path /var/www/stream.vapor.systems/dash; + } + } + } + ''; + + virtualHosts = { + "stream.vapor.systems" = { + forceSSL = true; + useACMEHost = "vapor.systems"; + locations = { + "/" = { + root = ./static; + }; + + "/hls" = { + extraConfig = '' + types { + application/vnd.apple.mpegurl m3u8; + video/mp2t ts; + } + root /var/www/stream.vapor.systems/; + add_header Cache-Control no-cache; + add_header Access-Control-Allow-Origin *; + ''; + }; + + "/dash" = { + extraConfig = '' + root /var/www/stream.vapor.systems/; + add_header Cache-Control no-cache; + add_header Access-Control-Allow-Origin *; + ''; + }; + }; + }; + }; + }; + + security.acme.certs = { + "vapor.systems" = { + extraDomainNames = [ "*.vapor.systems" ]; + }; + }; +} -- cgit v1.2.3