···251251 '';
252252 };
253253254254+ dynamicEndpointRefreshRestartSeconds = mkOption {
255255+ default = null;
256256+ example = 5;
257257+ type = with types; nullOr ints.unsigned;
258258+ description = lib.mdDoc ''
259259+ When the dynamic endpoint refresh that is configured via
260260+ dynamicEndpointRefreshSeconds exits (likely due to a failure),
261261+ restart that service after this many seconds.
262262+263263+ If set to `null` the value of
264264+ {option}`networking.wireguard.dynamicEndpointRefreshSeconds`
265265+ will be used as the default.
266266+ '';
267267+ };
268268+254269 persistentKeepalive = mkOption {
255270 default = null;
256271 type = with types; nullOr int;
···348363 # cannot be used with systemd timers (see `man systemd.timer`),
349364 # which is why `simple` with a loop is the best choice here.
350365 # It also makes starting and stopping easiest.
366366+ #
367367+ # Restart if the service exits (e.g. when wireguard gives up after "Name or service not known" dns failures):
368368+ Restart = "always";
369369+ RestartSec = if null != peer.dynamicEndpointRefreshRestartSeconds
370370+ then peer.dynamicEndpointRefreshRestartSeconds
371371+ else peer.dynamicEndpointRefreshSeconds;
351372 };
373373+ unitConfig = lib.optionalAttrs dynamicRefreshEnabled {
374374+ StartLimitIntervalSec = 0;
375375+ };
352376353377 script = let
354378 wg_setup = concatStringsSep " " (