nixos/openvpn: applied nixpkgs-fmt

This commit is contained in:
gbtb
2022-12-12 23:39:11 +10:00
parent 3d17d6fff6
commit 8399ff1e34
+16 -15
View File
@@ -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 ];