make a little service to start the VPN only after network is connected to hopefully fix the VPN blocking wifi on shodan issue

This commit is contained in:
Lillian Violet 2025-08-20 14:30:52 +02:00
parent d7ae543cc2
commit e6c6bd012f

View file

@ -188,6 +188,23 @@
};
};
systemd.services."start-vpn-wg" =
if config.services.vpn-ip.enable
then {
path = with pkgs; [systemd];
enable = true;
unitConfig = {
Wants = "network-online.target";
After = "network-online.target";
};
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.systemd}/bin/systemctl start wg-quick-wg0.service";
RemainAfterExit = "yes";
};
}
else {};
networking =
if config.services.vpn-ip.enable
then {
@ -195,7 +212,7 @@
wg-quick.interfaces = {
wg0 = {
autostart = true;
autostart = false;
address = ["10.0.0.${config.services.vpn-ip.ip}/24" "fdc9:281f:04d7:9ee9::${config.services.vpn-ip.ip}/64"];
dns = ["10.0.0.1" "fdc9:281f:04d7:9ee9::1"];
listenPort = 51821;