From c882420159d79dfebc88540c5dc6f48f32c8e1e9 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 5 Oct 2025 16:02:50 +0900 Subject: [PATCH] nixos/toxvpn: replace systemd `script` with `ExecStart` Also replace `preStart` with `RuntimeDirectory`, which does the same thing in this case. --- nixos/modules/services/networking/toxvpn.nix | 25 ++++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/nixos/modules/services/networking/toxvpn.nix b/nixos/modules/services/networking/toxvpn.nix index 112c86187666..4688e410cee4 100644 --- a/nixos/modules/services/networking/toxvpn.nix +++ b/nixos/modules/services/networking/toxvpn.nix @@ -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";