diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix index 3a255b9172cc..78d312af978b 100644 --- a/nixos/modules/services/networking/openvpn.nix +++ b/nixos/modules/services/networking/openvpn.nix @@ -57,7 +57,8 @@ let ''}"} ''; - in { + in + { description = "OpenVPN instance ‘${name}’"; wantedBy = optional cfg.autoStart "multi-user.target"; @@ -71,14 +72,14 @@ let }; restartService = optionalAttrs cfg.restartAfterSleep { - openvpn-restart = { - wantedBy = [ "sleep.target" ]; - path = [ pkgs.procps ]; - script = "pkill --signal SIGHUP --exact openvpn"; - #SIGHUP makes openvpn process to self-exit and then it got restarted by systemd because of Restart=always - description = "Sends a signal to OpenVPN process to trigger a restart after return from sleep"; - }; + openvpn-restart = { + wantedBy = [ "sleep.target" ]; + path = [ pkgs.procps ]; + script = "pkill --signal SIGHUP --exact openvpn"; + #SIGHUP makes openvpn process to self-exit and then it got restarted by systemd because of Restart=always + description = "Sends a signal to OpenVPN process to trigger a restart after return from sleep"; }; + }; in @@ -92,7 +93,7 @@ in options = { services.openvpn.servers = mkOption { - default = {}; + default = { }; example = literalExpression '' { @@ -211,10 +212,10 @@ in }; - services.openvpn.restartAfterSleep = mkOption { - default = true; - type = types.bool; - description = lib.mdDoc "Whether OpenVPN clients should be restarted after sleep."; + services.openvpn.restartAfterSleep = mkOption { + default = true; + type = types.bool; + description = lib.mdDoc "Whether OpenVPN client should be restarted after sleep."; }; }; @@ -222,10 +223,10 @@ in ###### implementation - config = mkIf (cfg.servers != {}) { + config = mkIf (cfg.servers != { }) { systemd.services = (listToAttrs (mapAttrsFlatten (name: value: nameValuePair "openvpn-${name}" (makeOpenVPNJob value name)) cfg.servers)) - // restartService; + // restartService; environment.systemPackages = [ openvpn ];