mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
This commit is contained in:
@@ -79,6 +79,7 @@ in
|
||||
in
|
||||
{
|
||||
settings = {
|
||||
enableOmada = true;
|
||||
wan = {
|
||||
interface = "enp1s0";
|
||||
vlanId = null;
|
||||
|
||||
@@ -120,6 +120,43 @@
|
||||
description = "TP-Link Omada SDN controller (podman container)";
|
||||
};
|
||||
|
||||
proxy = {
|
||||
|
||||
enable = lib.mkEnableOption "internal reverse proxy (Caddy, wildcard cert via DNS-01)";
|
||||
|
||||
services = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule {
|
||||
|
||||
options = {
|
||||
backend = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "https://127.0.0.1:8043";
|
||||
description = "URL Caddy forwards to (internal/mesh address).";
|
||||
};
|
||||
insecureSkipVerify = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Skip TLS verification towards the backend.";
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
default = { };
|
||||
description = "Proxied services";
|
||||
};
|
||||
|
||||
allowVlans = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [
|
||||
"mgmt"
|
||||
"lan"
|
||||
];
|
||||
description = "VLANs whose clients may reach the proxy (443, plus 80 for the redirect).";
|
||||
};
|
||||
};
|
||||
|
||||
vlans = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule vlanModule);
|
||||
description = "VLANs setup for this router";
|
||||
@@ -314,5 +351,7 @@
|
||||
./iperf.nix
|
||||
./ipv6.nix
|
||||
./pppoe.nix
|
||||
./omada.nix
|
||||
./proxy.nix
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
roles.default.perInstance = { settings, ... }: {
|
||||
nixosModule =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
in
|
||||
{
|
||||
|
||||
config = lib.mkIf (settings.proxy.enable) {
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.all (v: settings.vlans ? ${v}) settings.proxy.allowVlans;
|
||||
message = "cnx.router.proxy.allowVlans must name VLANs defined in cnx.router.vlans.";
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user