From 0c2f06bd72ead0b8d2e216bebd5f6a15327cfbdc Mon Sep 17 00:00:00 2001 From: Julian Sutter Date: Fri, 18 Jul 2025 22:09:02 -0700 Subject: [PATCH] Fix cloudflared service with preStart script to ensure log directory and file exist --- desktop/ftl.host.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/desktop/ftl.host.nix b/desktop/ftl.host.nix index d7b433d..6dc35b9 100644 --- a/desktop/ftl.host.nix +++ b/desktop/ftl.host.nix @@ -26,6 +26,13 @@ in { wants = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; + # Create directory for log files + preStart = '' + mkdir -p "$(dirname ${tunnel.logPath})" + touch ${tunnel.logPath} + chmod 644 ${tunnel.logPath} + ''; + serviceConfig = { ExecStart = "${pkgs.cloudflared}/bin/cloudflared access tcp --hostname ${tunnel.remoteHost} --url ${tunnel.remoteTarget} --port ${toString tunnel.localBindPort} --logfile ${tunnel.logPath}"; Restart = "always";