nixos-config/modules/system/services/server/webserver/nginx/rtmp/default.nix

33 lines
912 B
Nix
Raw Normal View History

2025-02-25 01:37:56 -05:00
{ config, lib, pkgs, ... }:
2024-10-22 21:08:23 -04:00
{
2025-02-25 01:37:56 -05:00
options.services.nginx.rtmp.enable = lib.mkEnableOption "Enable an RTMP server using Nginx";
config = lib.mkIf config.services.nginx.rtmp.enable {
services.nginx = {
package = (pkgs.nginx.override {
modules = with pkgs.nginxModules; [ rtmp ];
});
appendConfig = ''
rtmp {
server {
listen 1935;
chunk_size 4096;
allow publish all;
application stream {
record off;
live on;
allow play all;
hls on;
2025-01-02 10:13:00 -05:00
hls_path /var/www/landing-page/streams/hls/;
hls_fragment_naming system;
hls_fragment 3;
hls_playlist_length 40;
}
2024-10-22 21:08:23 -04:00
}
}
'';
};
2025-02-25 01:37:56 -05:00
systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www/landing-page/streams/hls/" ];
2024-12-20 19:08:07 -05:00
};
2024-10-22 21:08:23 -04:00
}