nixos/toxvpn: replace systemd script with ExecStart
Also replace `preStart` with `RuntimeDirectory`, which does the same thing in this case.
This commit is contained in:
@@ -43,20 +43,19 @@ with lib;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
||||
preStart = ''
|
||||
mkdir -p /run/toxvpn || true
|
||||
chown toxvpn /run/toxvpn
|
||||
'';
|
||||
|
||||
path = [ pkgs.toxvpn ];
|
||||
|
||||
script = ''
|
||||
exec toxvpn -i ${config.services.toxvpn.localip} -l /run/toxvpn/control -u toxvpn -p ${toString config.services.toxvpn.port} ${
|
||||
lib.concatMapStringsSep " " (x: "-a ${x}") config.services.toxvpn.auto_add_peers
|
||||
}
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart =
|
||||
let
|
||||
args = lib.cli.toCommandLineShellGNU { } {
|
||||
i = config.services.toxvpn.localip;
|
||||
l = "/run/toxvpn/control";
|
||||
u = "toxvpn";
|
||||
p = config.services.toxvpn.port;
|
||||
a = config.services.toxvpn.auto_add_peers;
|
||||
};
|
||||
in
|
||||
"${lib.getExe pkgs.toxvpn} ${args}";
|
||||
RuntimeDirectory = "toxvpn";
|
||||
KillMode = "process";
|
||||
Restart = "on-success";
|
||||
Type = "notify";
|
||||
|
||||
Reference in New Issue
Block a user