From 450b396bed760c18d0ed5f8915e5f0b34b04a904 Mon Sep 17 00:00:00 2001 From: b3nj5m1n Date: Sat, 14 Oct 2023 11:14:09 +0200 Subject: [PATCH] Wireguard still doesn't work for some reason --- nix/nixos/chinstrap.nix | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/nix/nixos/chinstrap.nix b/nix/nixos/chinstrap.nix index 68bcb19..608f488 100644 --- a/nix/nixos/chinstrap.nix +++ b/nix/nixos/chinstrap.nix @@ -95,12 +95,45 @@ }; }; + # systemd.network = { + # enable = true; + # netdevs = { + # "50-wg0" = { + # netdevConfig = { + # Kind = "wireguard"; + # Name = "wg0"; + # MTUBytes = "1300"; + # }; + # wireguardConfig = { + # PrivateKeyFile = "/home/admin/.local/share/wireguard/Server.private"; + # ListenPort = 30005; + # }; + # wireguardPeers = [ + # { + # wireguardPeerConfig = { + # PublicKey = "PtMjckiDgt30S4gzk+fdlJiBJUMaUlP+44KN2G8AbXI="; + # AllowedIPs = ["10.0.0.4"]; + # }; + # } + # ]; + # }; + # }; + # networks.wg0 = { + # matchConfig.Name = "wg0"; + # address = ["10.0.0.4/24"]; + # networkConfig = { + # IPMasquerade = "ipv4"; + # IPForward = true; + # }; + # }; + # }; + # networking.wireguard.enable = true; networking.wireguard.interfaces = { wg0 = { ips = ["10.0.0.0/8"]; listenPort = 30005; - postSetup = '' + preSetup = '' ${pkgs.nftables}/bin/nft add rule nixos-nat post ip saddr 10.0.0.0/8 oif end0 masquerade ''; postShutdown = ''