Allow server to be imported, deprioritize Jimbo. Those who nose.

This commit is contained in:
Jimbo 2025-01-01 02:02:00 -05:00
parent 5f0edcbb09
commit d873588c59
42 changed files with 228 additions and 207 deletions

View file

@ -1,20 +1,22 @@
{ pkgs, config, ... }:
{ pkgs, config, lib, ... }:
{
imports = [
./rtmp
./virtualhosts
];
services.nginx = {
enable = config.system.server.enable;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
};
config = lib.mkIf config.system.server.enable {
services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
};
networking.firewall.allowedTCPPorts = [
80
443
];
networking.firewall.allowedTCPPorts = [
80
443
];
};
}

View file

@ -1,31 +1,40 @@
{ pkgs, config, ... }:
{ pkgs, config, lib, ... }:
{
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;
hls_path /var/www/Jimbo-Landing-Page/streams/hls/;
hls_fragment_naming system;
hls_fragment 3;
hls_playlist_length 40;
}
}
}
'';
options.services.nginx.rtmp = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
};
systemd.services.nginx.serviceConfig = {
ReadWritePaths = [ "/var/www/Jimbo-Landing-Page/streams/hls/" ];
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;
hls_path /var/www/Jimbo-Landing-Page/streams/hls/;
hls_fragment_naming system;
hls_fragment 3;
hls_playlist_length 40;
}
}
}
'';
};
systemd.services.nginx.serviceConfig = {
ReadWritePaths = [ "/var/www/Jimbo-Landing-Page/streams/hls/" ];
};
};
}

View file

@ -1,6 +1,6 @@
{ ... }:
{
imports = [
./jim1
./p1
];
}

View file

@ -1,22 +1,22 @@
{ config, ... }:
{ config, lib, ... }:
{
services.nginx.virtualHosts."${config.domains.jim1}" = {
services.nginx.virtualHosts."${config.domains.p1}" = lib.mkIf config.system.server.enable{
enableACME = true;
addSSL = true;
root = "/var/www/Jimbo-Landing-Page";
root = "/var/www/landing-page";
locations = {
"/.well-known/matrix/client".extraConfig = ''
default_type application/json;
return 200 '
{
"m.homeserver": {
"base_url": "https://matrix.${config.domains.jim1}"
"base_url": "https://matrix.${config.domains.p1}"
},
"m.identity_server": {
"base_url": "https://matrix.org"
},
"org.matrix.msc3575.proxy": {
"url": "https://matrix.${config.domains.jim1}"
"url": "https://matrix.${config.domains.p1}"
}
}
';
@ -24,7 +24,7 @@
"/.well-known/matrix/server".extraConfig = ''
default_type application/json;
return 200 '{ "m.server": "matrix.${config.domains.jim1}:443" }';
return 200 '{ "m.server": "matrix.${config.domains.p1}:443" }';
'';
};
};