From b1b68c514d2eb96b229e474820637eb33179813c Mon Sep 17 00:00:00 2001 From: DavHau Date: Tue, 14 Oct 2025 12:02:59 +0700 Subject: [PATCH] wireguard/docs: fix nix code in examples This was using outdated syntax --- clanServices/wireguard/README.md | 64 ++++++++++++++++---------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/clanServices/wireguard/README.md b/clanServices/wireguard/README.md index 566a3ade8..a87106c4f 100644 --- a/clanServices/wireguard/README.md +++ b/clanServices/wireguard/README.md @@ -85,22 +85,27 @@ graph TB ### Basic Setup with Single Controller ```nix -# In your flake.nix or inventory +# In your clan.nix { - services.wireguard.server1 = { - roles.controller = { - # Public endpoint where this controller can be reached - endpoint = "vpn.example.com"; - # Optional: Change the UDP port (default: 51820) - port = 51820; + instances = { + wireguard = { + module.name = "wireguard"; + module.input = "clan-core"; + roles.controller = { + machines.server1 = {}; + settings = { + # Public endpoint where this controller can be reached + endpoint = "vpn.example.com"; + # Optional: Change the UDP port (default: 51820) + port = 51820; + }; + }; + roles.peer = { + # No configuration needed if only one controller exists + machines.laptop1 = {}; + }; }; - }; - - services.wireguard.laptop1 = { - roles.peer = { - # No configuration needed if only one controller exists - }; - }; + } } ``` @@ -108,24 +113,21 @@ graph TB ```nix { - services.wireguard.server1 = { - roles.controller = { - endpoint = "vpn1.example.com"; + instances = { + wireguard = { + module.name = "wireguard"; + module.input = "clan-core"; + roles.controller.machines = { + server1.settings.endpoint = "vpn1.example.com"; + server2.settings.endpoint = "vpn2.example.com"; + server3.settings.endpoint = "vpn3.example.com"; + }; + roles.peer.machines.laptop1 = { + # Must specify which controller subnet is exposed as the default in /etc/hosts, when multiple controllers exist + settings.controller = "server1"; + }; }; - }; - - services.wireguard.server2 = { - roles.controller = { - endpoint = "vpn2.example.com"; - }; - }; - - services.wireguard.laptop1 = { - roles.peer = { - # Must specify which controller subnet is exposed as the default in /etc/hosts, when multiple controllers exist - controller = "server1"; - }; - }; + } } ```