universe/hosts/earth/vpn.nix
2025-03-03 00:00:36 +05:00

21 lines
557 B
Nix

{pkgs, ...}: {
systemd.services.awg0 = {
enable = true;
description = "AmneziaWG Interface awg0";
after = ["network.target"];
wantedBy = ["multi-user.target"];
unitConfig = {
ConditionPathExists = "/run/secrets.d/awg0.conf";
};
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.amneziawg-tools}/bin/awg-quick up /run/secrets.d/awg0.conf";
ExecStop = "${pkgs.amneziawg-tools}/bin/awg-quick down /run/secrets.d/awg0.conf";
Restart = "on-failure";
};
};
}