comments, wgautomesh wrapper fix and removed unncessary logic
This commit is contained in:
parent
9080c75f6d
commit
589841c265
2 changed files with 11 additions and 7 deletions
|
@ -5,13 +5,13 @@
|
|||
}: let
|
||||
prefix = "lyn";
|
||||
|
||||
#define wireguard subnets
|
||||
#subnets routed through wireguard
|
||||
wg_subnets = {
|
||||
IPv4 = "10.35.0.1/24";
|
||||
IPv6 = "fd1a:acab:cafe:1337::/64";
|
||||
};
|
||||
|
||||
#Below is where all hosts are defined
|
||||
#hosts are defined here
|
||||
hosts = {
|
||||
wg-gateway = {
|
||||
wg = {
|
||||
|
@ -126,9 +126,16 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
${prefix}.network = {
|
||||
inherit hosts wg_subnets;
|
||||
};
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.any (host: host.v4 != null || host.v6 != null) (lib.attrValues hosts);
|
||||
message = "At least one of v4 or v6 must be defined for each host";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,10 +17,7 @@
|
|||
lib.mapAttrs (name: host: {
|
||||
pubkey = host.wg.pubkey;
|
||||
#if there is no public IP, make endpoint null so wgautomesh knows it unknown
|
||||
endpoint =
|
||||
if host.${version}.public == ""
|
||||
then null
|
||||
else host.${version}.public;
|
||||
endpoint = host.${version}.public;
|
||||
address = host.${version}.internal;
|
||||
})
|
||||
filteredHosts;
|
||||
|
@ -47,7 +44,7 @@ in {
|
|||
};
|
||||
services.wgautomesh = {
|
||||
enable = true;
|
||||
services.wgautomesh.settings = {
|
||||
settings = {
|
||||
interface = "wg0";
|
||||
peers =
|
||||
if cfg.useIPv6
|
||||
|
|
Loading…
Reference in a new issue