feat(access): openwebrx

This commit is contained in:
arcnmx 2024-05-13 14:03:02 -07:00
parent d92c986f8a
commit 7486517713
3 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,59 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkDefault;
inherit (config.services) openwebrx;
name.shortServer = mkDefault "webrx";
upstreamName = "openwebrx'access";
in {
config.services.nginx = {
upstreams'.${upstreamName}.servers = {
local = {
enable = mkDefault openwebrx.enable;
addr = mkDefault "localhost";
port = mkIf openwebrx.enable (mkDefault openwebrx.port);
};
service = { upstream, ... }: {
enable = mkIf upstream.servers.local.enable (mkDefault false);
accessService = {
name = "openwebrx";
};
};
};
virtualHosts = let
copyFromVhost = mkDefault "openwebrx";
locations = {
"/" = {
proxy.enable = true;
};
"/ws/" = {
proxy = {
enable = true;
websocket.enable = true;
};
extraConfig = ''
proxy_buffering off;
'';
};
};
in {
openwebrx = {
inherit name locations;
proxy.upstream = mkDefault upstreamName;
vouch.enable = mkDefault true;
};
openwebrx'local = {
inherit name locations;
ssl.cert = {
inherit copyFromVhost;
};
proxy = {
inherit copyFromVhost;
};
local.enable = mkDefault true;
};
};
};
}

View file

@ -38,6 +38,7 @@ in {
nixos.access.freepbx
nixos.access.unifi
nixos.access.kitchencam
nixos.access.openwebrx
nixos.access.home-assistant
nixos.access.zigbee2mqtt
nixos.access.grocy
@ -207,6 +208,14 @@ in {
virtualHosts.kitchencam'local.allServerNames
];
};
webrx = {
inherit (nginx) group;
domain = virtualHosts.openwebrx.serverName;
extraDomainNames = mkMerge [
virtualHosts.openwebrx.otherServerNames
virtualHosts.openwebrx'local.allServerNames
];
};
yt = {
inherit (nginx) group;
domain = virtualHosts.invidious.serverName;
@ -295,6 +304,7 @@ in {
};
};
kitchencam.ssl.cert.enable = true;
openwebrx.ssl.cert.enable = true;
invidious = {
ssl.cert.enable = true;
};

View file

@ -23,6 +23,7 @@ module "hakurei_system_records" {
"smb",
"mqtt",
"kitchen",
"webrx",
"home",
"z2m",
"grocy",
@ -38,6 +39,7 @@ module "hakurei_system_records" {
"smb",
"mqtt",
"kitchen",
"webrx",
"yt",
]
}