mirror of
https://github.com/Noratrieb/vps.git
synced 2026-01-16 09:35:10 +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;
|
listenPort = 51820;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# TODO: put the actual setup here.
|
# Map from $HOST.local to the private IP.
|
||||||
networking.hosts = {
|
networking.hosts =
|
||||||
"10.0.0.1" = [ "vps1.local" ];
|
let
|
||||||
"10.0.0.3" = [ "vps3.local" ];
|
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;
|
age.secrets.wg_private.file = ../../secrets/wg_private_${name}.age;
|
||||||
networking.wg-quick.interfaces = {
|
networking.wg-quick.interfaces = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue