generated from methanium/template
Update stuff
This commit is contained in:
parent
82f7ea1184
commit
2058847d25
2 changed files with 4 additions and 26 deletions
|
|
@ -49,7 +49,7 @@ ssh -L 8081:127.0.0.1:8081 status-host
|
||||||
|
|
||||||
## NixOS
|
## NixOS
|
||||||
|
|
||||||
The included module serves the SPA with nginx on TCP 443 and MTP HTTP/3/WebTransport on UDP 443. Both use the same ACME certificate and origin.
|
The included module serves the SPA with MTP HTTP/3/WebTransport on UDP 443 using an ACME certificate.
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
|
|
|
||||||
28
flake.nix
28
flake.nix
|
|
@ -257,7 +257,7 @@
|
||||||
publicPort = lib.mkOption {
|
publicPort = lib.mkOption {
|
||||||
type = lib.types.port;
|
type = lib.types.port;
|
||||||
default = 443;
|
default = 443;
|
||||||
description = "Shared nginx TCP and MTP UDP public port.";
|
description = "Public UDP port for the MTP server.";
|
||||||
};
|
};
|
||||||
adminAddress = lib.mkOption {
|
adminAddress = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
|
|
@ -287,7 +287,7 @@
|
||||||
openFirewall = lib.mkOption {
|
openFirewall = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Open the public TCP and UDP port in the firewall.";
|
description = "Open the public UDP port in the firewall.";
|
||||||
};
|
};
|
||||||
openAdminFirewall = lib.mkOption {
|
openAdminFirewall = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
|
|
@ -332,32 +332,12 @@
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = "methanium-status";
|
group = "methanium-status";
|
||||||
};
|
};
|
||||||
users.users.nginx.extraGroups = [ "methanium-status" ];
|
|
||||||
|
|
||||||
security.acme.certs.${acmeHost} = {
|
security.acme.certs.${acmeHost} = {
|
||||||
group = "methanium-status";
|
group = "methanium-status";
|
||||||
reloadServices = [ "methanium-status.service" ];
|
reloadServices = [ "methanium-status.service" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx = {
|
|
||||||
enable = true;
|
|
||||||
virtualHosts.${cfg.hostName} = {
|
|
||||||
forceSSL = true;
|
|
||||||
enableACME = cfg.acmeHost == null;
|
|
||||||
useACMEHost = lib.mkIf (cfg.acmeHost != null) acmeHost;
|
|
||||||
root = cfg.frontendPackage;
|
|
||||||
listen = [
|
|
||||||
{ addr = "0.0.0.0"; port = cfg.publicPort; ssl = true; }
|
|
||||||
{ addr = "[::]"; port = cfg.publicPort; ssl = true; }
|
|
||||||
];
|
|
||||||
extraConfig = ''
|
|
||||||
add_header Alt-Svc 'h3=":${toString cfg.publicPort}"; ma=86400' always;
|
|
||||||
'';
|
|
||||||
locations."/".tryFiles = "$uri $uri/ /index.html";
|
|
||||||
locations."^~ /edit".return = "404";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.methanium-status = {
|
systemd.services.methanium-status = {
|
||||||
description = "Methanium Status monitor";
|
description = "Methanium Status monitor";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
@ -393,9 +373,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts =
|
networking.firewall.allowedTCPPorts = lib.optionals cfg.openAdminFirewall [ cfg.adminPort ];
|
||||||
lib.optionals cfg.openFirewall [ cfg.publicPort ]
|
|
||||||
++ lib.optionals cfg.openAdminFirewall [ cfg.adminPort ];
|
|
||||||
networking.firewall.allowedUDPPorts = lib.optionals cfg.openFirewall [ cfg.publicPort ];
|
networking.firewall.allowedUDPPorts = lib.optionals cfg.openFirewall [ cfg.publicPort ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue