2024-10-15 17:46:44 -04:00
|
|
|
{ pkgs, config, ... }:
|
2024-10-09 03:36:08 -04:00
|
|
|
{
|
2024-08-30 01:17:50 -04:00
|
|
|
services.nginx = {
|
2024-08-24 22:16:51 -04:00
|
|
|
enable = true;
|
|
|
|
package = (pkgs.nginx.override {
|
|
|
|
modules = with pkgs.nginxModules; [ rtmp ];
|
|
|
|
});
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
virtualHosts = {
|
2024-08-26 14:29:23 -04:00
|
|
|
# Landing page
|
2024-10-15 17:46:44 -04:00
|
|
|
"${config.secrets.jimDomain}" = {
|
2024-08-24 22:16:51 -04:00
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
2024-08-30 01:17:50 -04:00
|
|
|
root = "/var/www/Jimbo-Landing-Page";
|
2024-08-24 22:16:51 -04:00
|
|
|
locations = {
|
2024-08-26 13:07:59 -04:00
|
|
|
"/.well-known/matrix/client" = {
|
|
|
|
extraConfig = ''
|
2024-09-10 21:39:12 -04:00
|
|
|
default_type application/json;
|
|
|
|
return 200 '
|
|
|
|
{
|
|
|
|
"m.homeserver": {
|
2024-10-15 17:46:44 -04:00
|
|
|
"base_url": "https://matrix.${config.secrets.jimDomain}"
|
2024-09-10 21:39:12 -04:00
|
|
|
},
|
|
|
|
"m.identity_server": {
|
|
|
|
"base_url": "https://matrix.org"
|
|
|
|
},
|
|
|
|
"org.matrix.msc3575.proxy": {
|
2024-10-15 17:46:44 -04:00
|
|
|
"url": "https://matrix.${config.secrets.jimDomain}"
|
2024-09-10 21:39:12 -04:00
|
|
|
}
|
|
|
|
}';
|
2024-08-26 13:07:59 -04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
"/.well-known/matrix/server" = {
|
|
|
|
extraConfig = ''
|
2024-08-24 22:16:51 -04:00
|
|
|
default_type application/json;
|
2024-10-15 17:46:44 -04:00
|
|
|
return 200 '{"m.server": "matrix.${config.secrets.jimDomain}:443"}';
|
2024-08-26 13:07:59 -04:00
|
|
|
'';
|
|
|
|
};
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
appendConfig = ''
|
|
|
|
rtmp {
|
|
|
|
server {
|
|
|
|
listen 1935;
|
|
|
|
chunk_size 4096;
|
|
|
|
allow publish all;
|
|
|
|
application stream {
|
|
|
|
record off;
|
|
|
|
live on;
|
2024-08-30 01:17:50 -04:00
|
|
|
allow play all;
|
2024-08-24 22:16:51 -04:00
|
|
|
hls on;
|
2024-08-30 01:17:50 -04:00
|
|
|
hls_path /var/www/Jimbo-Landing-Page/streams/hls/;
|
|
|
|
hls_fragment_naming system;
|
|
|
|
hls_fragment 3;
|
2024-08-24 22:16:51 -04:00
|
|
|
hls_playlist_length 40;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-26 13:07:59 -04:00
|
|
|
# Allow Nginx to read and write to paths
|
2024-08-24 22:16:51 -04:00
|
|
|
systemd.services.nginx.serviceConfig = {
|
2024-08-30 01:17:50 -04:00
|
|
|
ReadWritePaths = [ "/var/www/Jimbo-Landing-Page/streams/hls/" ];
|
2024-08-24 22:16:51 -04:00
|
|
|
};
|
2024-09-04 20:22:13 -04:00
|
|
|
|
|
|
|
# Open HTTP and HTTPs ports
|
2024-09-10 21:39:12 -04:00
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
80 443
|
|
|
|
];
|
2024-08-24 22:16:51 -04:00
|
|
|
}
|