NixOS-Config/modules/system/devices/networking/wireguard/pc/default.nix

33 lines
780 B
Nix
Raw Normal View History

2024-10-20 13:58:10 -04:00
{ config, pkgs, ... }:
2024-10-09 03:36:08 -04:00
{
2024-10-20 13:58:10 -04:00
systemd.network = {
enable = true;
netdevs = {
"10-wg0" = {
netdevConfig = {
Kind = "wireguard";
Name = "wg0";
MTUBytes = 1300;
};
wireguardConfig = {
PrivateKeyFile = pkgs.writeText "privkey" config.secrets.wgClientPriv;
ListenPort = 9918;
};
wireguardPeers = [
{
PublicKey = config.secrets.wgServerPub;
AllowedIPs = [ "0.0.0.0/0" ];
Endpoint = "sv.${config.secrets.jimDomain}:51820";
}
];
};
};
networks.wg0 = {
matchConfig.Name = "wg0";
address = [ "10.100.0.19/24" ];
dns = [ "1.1.1.1" ];
gateway = [ "${config.ips.wgSpan}.1" ];
};
};
}