From ced7cfc02523e1bbc636373d24b7d16110ee587e Mon Sep 17 00:00:00 2001 From: sjau Date: Thu, 23 May 2019 22:09:01 +0200 Subject: [PATCH] wireguard: restart on failure As a oneshot service, if the startup failed it would never be attempted again. This is problematic when peer's addresses require DNS. DNS may not be reliably available at the time wireguard starts. Converting this to a simple service with Restart and RestartAfter directives allows the service to be reattempted, but at the cost of losing the oneshot semantics. Signed-off-by: Maximilian Bosch (cherry picked from commit 1bff53cb8408f583f4f9a02e487dbe2fa4110271) --- nixos/modules/services/networking/wireguard.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/wireguard.nix b/nixos/modules/services/networking/wireguard.nix index 41aff1480a05..7a3b446b6f46 100644 --- a/nixos/modules/services/networking/wireguard.nix +++ b/nixos/modules/services/networking/wireguard.nix @@ -197,7 +197,9 @@ let path = with pkgs; [ kmod iproute wireguard-tools ]; serviceConfig = { - Type = "oneshot"; + Type = "simple"; + Restart = "on-failure"; + RestartSec = "5s"; RemainAfterExit = true; };