mirror of
https://github.com/Noratrieb/vps.git
synced 2026-01-14 16:55:00 +01:00
more dynamic
This commit is contained in:
parent
478b587a41
commit
8d0c65448a
1 changed files with 14 additions and 5 deletions
|
|
@ -4,11 +4,20 @@ let
|
|||
listenPort = 51820;
|
||||
in
|
||||
{
|
||||
# TODO: put the actual setup here.
|
||||
networking.hosts = {
|
||||
"10.0.0.1" = [ "vps1.local" ];
|
||||
"10.0.0.3" = [ "vps3.local" ];
|
||||
};
|
||||
# Map from $HOST.local to the private IP.
|
||||
networking.hosts =
|
||||
let
|
||||
hostsEntries = map
|
||||
(host:
|
||||
let hostConfig = builtins.getAttr host networkingConfig; in
|
||||
if builtins.hasAttr "wg" hostConfig then {
|
||||
name = hostConfig.wg.privateIP;
|
||||
value = [ "${host}.local" ];
|
||||
} else null)
|
||||
(builtins.attrNames networkingConfig);
|
||||
wgHostEntries = builtins.filter (entry: entry != null) hostsEntries;
|
||||
in
|
||||
builtins.listToAttrs wgHostEntries;
|
||||
|
||||
age.secrets.wg_private.file = ../../secrets/wg_private_${name}.age;
|
||||
networking.wg-quick.interfaces = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue