diff options
| author | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-01-08 11:33:27 -0600 |
|---|---|---|
| committer | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-01-08 11:33:27 -0600 |
| commit | 9bd9efe8b26ba34e0cbba3e281749a4e262558e0 (patch) | |
| tree | c790bcaf3c3d1804d09cfe0e589103c35b14bf17 /modules/services/nixos/wireguard/client.nix | |
| parent | 806f697f17214212197f09a8c6aaf6da307e496f (diff) | |
in-progress wireguard configurion
Diffstat (limited to 'modules/services/nixos/wireguard/client.nix')
| -rw-r--r-- | modules/services/nixos/wireguard/client.nix | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/modules/services/nixos/wireguard/client.nix b/modules/services/nixos/wireguard/client.nix new file mode 100644 index 0000000..ec41ad5 --- /dev/null +++ b/modules/services/nixos/wireguard/client.nix @@ -0,0 +1,50 @@ +{ + config, + lib, + ... +}: let + cfg = config.collinux.services.networking.wireguard; +in + lib.mkIf (cfg.enable && cfg.localPeer.role == "spoke") { + boot.extraModulePackages = [config.boot.kernelPackages.wireguard]; + + # we know the machine is configured to use networkd already + systemd.network = { + netdevs = { + "10-wg0" = { + netdevConfig = { + Kind = "wireguard"; + Name = "wg0"; + }; + + wireguardConfig = { + PrivateKeyFile = cfg.privateKeyFile; + ListenPort = 51820; + }; + + wireguardPeers = [ + { + PublicKey = ""; # will configure later + AllowedIPs = ["100.100.0.1"]; + Endpoint = "williamsfam.us.com:51820"; # not configured yet + } + ]; + }; + }; + + networks."12-wireguard" = { + name = "wg0"; + + networkConfig = { + Address = cfg.ip; + Gateway = "100.100.0.1"; + DHCP = "no"; + + # disable ipv6 addresses + IPv6AcceptRA = "no"; + IPv6PrivacyExtensions = "no"; + LinkLocalAddressing = "no"; + }; + }; + }; + } |
