mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(access): mpd
This commit is contained in:
parent
2340ca381d
commit
d699eea7ff
3 changed files with 85 additions and 0 deletions
73
nixos/access/mpd.nix
Normal file
73
nixos/access/mpd.nix
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkDefault;
|
||||
name.shortServer = mkDefault "radio";
|
||||
upstreamName = "radio'access";
|
||||
upstreamHigh = "${upstreamName}'high";
|
||||
upstreamLow = "${upstreamName}'low";
|
||||
in {
|
||||
config.services.nginx = {
|
||||
upstreams' = {
|
||||
${upstreamHigh} = {
|
||||
servers.service = {
|
||||
#accessService.system = "shanghai";
|
||||
addr = "shanghai.local.cutie.moe";
|
||||
port = 32101;
|
||||
};
|
||||
};
|
||||
${upstreamLow} = {
|
||||
servers.service = {
|
||||
#accessService.system = "shanghai";
|
||||
addr = "shanghai.local.cutie.moe";
|
||||
port = 32102;
|
||||
};
|
||||
};
|
||||
};
|
||||
virtualHosts = let
|
||||
copyFromVhost = mkDefault "mpd";
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations = {
|
||||
"/low" = {
|
||||
inherit extraConfig;
|
||||
proxy = {
|
||||
enable = true;
|
||||
upstream = mkDefault upstreamLow;
|
||||
};
|
||||
};
|
||||
"/high" = {
|
||||
inherit extraConfig;
|
||||
proxy = {
|
||||
enable = true;
|
||||
upstream = mkDefault upstreamHigh;
|
||||
};
|
||||
};
|
||||
"/" = {
|
||||
extraConfig = ''
|
||||
rewrite ^.*$ /high last;
|
||||
return 404;
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
mpd = {
|
||||
inherit name locations;
|
||||
proxy.upstream = mkDefault upstreamName;
|
||||
};
|
||||
mpd'local = {
|
||||
inherit name locations;
|
||||
ssl.cert = {
|
||||
inherit copyFromVhost;
|
||||
};
|
||||
proxy = {
|
||||
inherit copyFromVhost;
|
||||
};
|
||||
local.enable = mkDefault true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ in {
|
|||
nixos.access.loki
|
||||
nixos.access.kitchencam
|
||||
nixos.access.moonraker
|
||||
nixos.access.mpd
|
||||
nixos.access.openwebrx
|
||||
nixos.access.deluge
|
||||
nixos.access.home-assistant
|
||||
|
|
@ -268,6 +269,14 @@ in {
|
|||
virtualHosts.moonraker'local.allServerNames
|
||||
];
|
||||
};
|
||||
radio = {
|
||||
inherit (nginx) group;
|
||||
domain = virtualHosts.mpd.serverName;
|
||||
extraDomainNames = mkMerge [
|
||||
virtualHosts.mpd.otherServerNames
|
||||
virtualHosts.mpd'local.allServerNames
|
||||
];
|
||||
};
|
||||
webrx = {
|
||||
inherit (nginx) group;
|
||||
domain = virtualHosts.openwebrx.serverName;
|
||||
|
|
@ -400,6 +409,7 @@ in {
|
|||
kitchencam.ssl.cert.enable = true;
|
||||
moonraker.ssl.cert.enable = true;
|
||||
openwebrx.ssl.cert.enable = true;
|
||||
mpd.ssl.cert.enable = true;
|
||||
deluge.ssl.cert.enable = true;
|
||||
invidious = {
|
||||
ssl.cert.enable = true;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ module "hakurei_system_records" {
|
|||
"mqtt",
|
||||
"kitchen",
|
||||
"print",
|
||||
"radio",
|
||||
"webrx",
|
||||
"deluge",
|
||||
"home",
|
||||
|
|
@ -48,6 +49,7 @@ module "hakurei_system_records" {
|
|||
"mqtt",
|
||||
"kitchen",
|
||||
"print",
|
||||
"radio",
|
||||
"webrx",
|
||||
"syncplay",
|
||||
"yt",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue