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:
h7x4
2025-10-27 18:52:11 +09:00
parent c1237fb6de
commit c882420159
+12 -13
View File
@@ -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";