Move server to persistence, still have stuff to fix

This commit is contained in:
Jimbo 2025-01-17 17:06:28 -05:00
parent ce6ffd9ee7
commit cc68f883ba
35 changed files with 293 additions and 235 deletions

View file

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

View file

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

View file

@ -1,7 +0,0 @@
{ ... }:
{
imports = [
./p1
./p2
];
}

View file

@ -1,26 +0,0 @@
{ config, lib, ... }:
{
services.nginx.virtualHosts."${config.domains.p1}" = lib.mkIf config.system.server.enable {
enableACME = true;
addSSL = true;
locations = {
"/.well-known/matrix/client".extraConfig = ''
default_type application/json;
return 200 '
{
"m.homeserver": {
"base_url": "https://matrix.${config.domains.p1}"
},
"m.identity_server": {
"base_url": "https://matrix.org"
}
}
';
'';
"/.well-known/matrix/server".extraConfig = ''
default_type application/json;
return 200 '{ "m.server": "matrix.${config.domains.p1}:443" }';
'';
};
};
}

View file

@ -1,8 +0,0 @@
{ config, lib, ... }:
{
services.nginx.virtualHosts."${config.domains.p2}" = lib.mkIf config.system.server.enable {
enableACME = true;
addSSL = true;
root = "/var/www/landing-page";
};
}