fixed linting
This commit is contained in:
parent
6105d8bc05
commit
0933b2b504
59 changed files with 2843 additions and 2638 deletions
|
@ -1,30 +1,32 @@
|
|||
{ lib, hosts, config, ... }:
|
||||
with lib;
|
||||
let cfg = config.services.v.nginx;
|
||||
in {
|
||||
in {
|
||||
options.services.v.nginx.autoExpose =
|
||||
mkEnableOption "generate vhosts";
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
|
||||
proxy = url: {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = url;
|
||||
proxyWebsockets = true;
|
||||
proxy = url: {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = url;
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hosts' =
|
||||
filter (hasAttr "exposes") (attrValues hosts.${config.networking.domain});
|
||||
exposes = { ip, exposes, ... }:
|
||||
map ({ domain, port ? 80}: { inherit ip domain port; }) (attrValues exposes);
|
||||
mkVhost = { ip, domain, port}: {
|
||||
"${domain}" = proxy "http://${ip}:${toString port}";
|
||||
hosts' =
|
||||
filter (hasAttr "exposes") (attrValues hosts.${config.networking.domain});
|
||||
exposes = { ip, exposes, ... }:
|
||||
map ({ domain, port ? 80 }: { inherit ip domain port; }) (attrValues exposes);
|
||||
mkVhost = { ip, domain, port }: {
|
||||
"${domain}" = proxy "http://${ip}:${toString port}";
|
||||
};
|
||||
vhosts = foldr (el: acc: acc // mkVhost el) { } (concatMap exposes hosts');
|
||||
in
|
||||
mkIf cfg.autoExpose {
|
||||
services.nginx.virtualHosts = vhosts;
|
||||
};
|
||||
vhosts = foldr (el: acc: acc // mkVhost el) { } (concatMap exposes hosts');
|
||||
in mkIf cfg.autoExpose {
|
||||
services.nginx.virtualHosts = vhosts;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue