mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
chore(ci): nf-fmt-nix
This commit is contained in:
parent
4e43829934
commit
20cd95cf3c
2 changed files with 45 additions and 36 deletions
|
|
@ -50,8 +50,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
virtualHosts = let
|
virtualHosts = let
|
||||||
printerCams = [ 2 ];
|
printerCams = [2];
|
||||||
kitchenCams = [ 1 3 ];
|
kitchenCams = [1 3];
|
||||||
mkSubFilter = port: path: ''
|
mkSubFilter = port: path: ''
|
||||||
sub_filter '${port.protocol}://$host:${toString port.port}/' '${path}';
|
sub_filter '${port.protocol}://$host:${toString port.port}/' '${path}';
|
||||||
'';
|
'';
|
||||||
|
|
@ -79,35 +79,37 @@ in {
|
||||||
streamLocations =
|
streamLocations =
|
||||||
map (mkStreamLocation upstreamNamePrinter) printerCams
|
map (mkStreamLocation upstreamNamePrinter) printerCams
|
||||||
++ map (mkStreamLocation upstreamNameKitchen) kitchenCams;
|
++ map (mkStreamLocation upstreamNameKitchen) kitchenCams;
|
||||||
locations = {
|
locations =
|
||||||
"/" = {
|
{
|
||||||
return = "302 /kitchen/";
|
"/" = {
|
||||||
};
|
return = "302 /kitchen/";
|
||||||
"/kitchen" = {
|
|
||||||
proxy = {
|
|
||||||
enable = true;
|
|
||||||
upstream = mkDefault upstreamNameKitchen;
|
|
||||||
path = "/";
|
|
||||||
};
|
};
|
||||||
extraConfig = subFilterConfig "/kitchen/";
|
"/kitchen" = {
|
||||||
};
|
proxy = {
|
||||||
"/printer" = {
|
enable = true;
|
||||||
proxy = {
|
upstream = mkDefault upstreamNameKitchen;
|
||||||
enable = true;
|
path = "/";
|
||||||
upstream = mkDefault upstreamNamePrinter;
|
};
|
||||||
path = "/";
|
extraConfig = subFilterConfig "/kitchen/";
|
||||||
};
|
};
|
||||||
extraConfig = subFilterConfig "/printer/";
|
"/printer" = {
|
||||||
};
|
proxy = {
|
||||||
"~ ^/(stream|motion|substream|current|source|cameras\\.json|status\\.json)$" = {
|
enable = true;
|
||||||
proxy = {
|
upstream = mkDefault upstreamNamePrinter;
|
||||||
enable = true;
|
path = "/";
|
||||||
upstream = mkDefault "${upstreamNameKitchen}'stream";
|
};
|
||||||
path = "";
|
extraConfig = subFilterConfig "/printer/";
|
||||||
};
|
};
|
||||||
extraConfig = streamConfig;
|
"~ ^/(stream|motion|substream|current|source|cameras\\.json|status\\.json)$" = {
|
||||||
};
|
proxy = {
|
||||||
} // mergeAttrsList streamLocations;
|
enable = true;
|
||||||
|
upstream = mkDefault "${upstreamNameKitchen}'stream";
|
||||||
|
path = "";
|
||||||
|
};
|
||||||
|
extraConfig = streamConfig;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// mergeAttrsList streamLocations;
|
||||||
listen' = {
|
listen' = {
|
||||||
http = {};
|
http = {};
|
||||||
https.ssl = true;
|
https.ssl = true;
|
||||||
|
|
@ -130,9 +132,15 @@ in {
|
||||||
locations = mapAttrs (name: location:
|
locations = mapAttrs (name: location:
|
||||||
location
|
location
|
||||||
// {
|
// {
|
||||||
${if location ? proxy then "proxy" else null} = location.proxy // (mapDefaults {
|
${
|
||||||
inherit (nginx.virtualHosts.kitchencam.locations.${name}.proxy) upstream path;
|
if location ? proxy
|
||||||
});
|
then "proxy"
|
||||||
|
else null
|
||||||
|
} =
|
||||||
|
location.proxy
|
||||||
|
// (mapDefaults {
|
||||||
|
inherit (nginx.virtualHosts.kitchencam.locations.${name}.proxy) upstream path;
|
||||||
|
});
|
||||||
})
|
})
|
||||||
locations;
|
locations;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,13 @@ in {
|
||||||
};
|
};
|
||||||
systemd.services.unifi = let
|
systemd.services.unifi = let
|
||||||
restartConfig = {
|
restartConfig = {
|
||||||
restartTriggers = mkForce [ ];
|
restartTriggers = mkForce [];
|
||||||
restartIfChanged = false;
|
restartIfChanged = false;
|
||||||
};
|
};
|
||||||
conf.gensokyo-zone.sharedMounts.unifi.path = mkDefault "/var/lib/unifi";
|
conf.gensokyo-zone.sharedMounts.unifi.path = mkDefault "/var/lib/unifi";
|
||||||
in mkIf cfg.enable (mkMerge [
|
in
|
||||||
conf
|
mkIf cfg.enable (mkMerge [
|
||||||
(mkIf delayRestart restartConfig)
|
conf
|
||||||
]);
|
(mkIf delayRestart restartConfig)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue