blob: a9dcb157198658071994bc6c49570eaa8a13b29f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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" ];
};
};
}
|