aboutsummaryrefslogtreecommitdiff
path: root/modules/rtmp/default.nix
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2024-03-29 13:55:03 +0100
committerMax Audron <audron@cocaine.farm>2024-03-29 13:55:03 +0100
commit3e39e00ee7d3023219f75d9164232a5cde187aeb (patch)
tree2fd83cf0119af572028ddedb70d1d9268effc037 /modules/rtmp/default.nix
parentadd hydra secrets (diff)
add rtmp and laplace
Diffstat (limited to '')
-rw-r--r--modules/rtmp/default.nix65
1 files changed, 65 insertions, 0 deletions
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" ];
+ };
+ };
+}