mob next [ci-skip] [ci skip] [skip ci]

lastFile:modules/clan/gw-router/omada.nix
This commit is contained in:
2026-08-11 13:59:26 +07:00
parent 3f5ded44af
commit 1f45fff740
2 changed files with 49 additions and 0 deletions
+6
View File
@@ -114,6 +114,12 @@
}; };
}; };
enableOmada = lib.mkOption {
type = lib.types.bool;
default = false;
description = "TP-Link Omada SDN controller (podman container)";
};
vlans = lib.mkOption { vlans = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule vlanModule); type = lib.types.attrsOf (lib.types.submodule vlanModule);
description = "VLANs setup for this router"; description = "VLANs setup for this router";
+43
View File
@@ -0,0 +1,43 @@
{
roles.default.perInstance = { settings, ... }: {
nixosModule =
{
config,
lib,
...
}:
let
dir = config.clan.core.settings.directory;
instance = "zerotier";
networkId = builtins.readFile "${dir}/vars/shared/zerotier-network-${instance}/network-id/value";
full = "fd" + networkId + "9993";
hextet = i: builtins.substring (i * 4) 4 full;
subnetZtier = "${hextet 0}:${hextet 1}:${hextet 2}:${hextet 3}:${hextet 4}:${builtins.substring 20 2 full}00::/88";
in
{
config = lib.mkIf (settings.enableOmada) {
virtualisation.podman.enable = true;
virtualisation.oci-containers = {
backend = "podman";
containers.omada = {
image = "docker.io/mbentley/omada-controller:5.15";
extraOptions = [ "--network=host" ];
environment.TZ = config.time.timeZone;
volumes = [
"/var/lib/omada/data:/opt/tplink/EAPController/data"
"/var/lib/omada/logs:/opt/tplink/EAPController/logs"
];
};
};
networking.firewall.extraInputRules = ''
ip6 saddr ${subnetZtier} tcp dport 8043 accept comment "omada ui over the mesh"
'';
clan.core.state.omada.folders = [ "/var/lib/omada" ];
};
};
};
}