From ddec7ebe50d46b30abd125c647340293c669731e Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 10 Aug 2025 20:52:03 -0700 Subject: [PATCH] Try fix --- nix/nixos-module.nix | 4 ++++ server/lib/systant/command_executor.ex | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/nix/nixos-module.nix b/nix/nixos-module.nix index 9a00294..71b2e88 100644 --- a/nix/nixos-module.nix +++ b/nix/nixos-module.nix @@ -79,6 +79,10 @@ in SYSTANT_PUBLISH_INTERVAL = toString cfg.publishInterval; # Override RELEASE_COOKIE to bypass file reading RELEASE_COOKIE = "systant-bypass-cookie"; + # Set proper PATH for NixOS + PATH = "/run/current-system/sw/bin:/run/wrappers/bin:\${PATH}"; + # Set log level to debug for troubleshooting + SYSTANT_LOG_LEVEL = "debug"; }; serviceConfig = { diff --git a/server/lib/systant/command_executor.ex b/server/lib/systant/command_executor.ex index 4dba27a..6257b75 100644 --- a/server/lib/systant/command_executor.ex +++ b/server/lib/systant/command_executor.ex @@ -253,10 +253,18 @@ defmodule Systant.CommandExecutor do env = build_command_environment() Logger.info("Executing system command: #{inspect(final_command)} (timeout: #{timeout}ms)") + Logger.debug("Environment PATH: #{Map.get(env, "PATH")}") + Logger.debug("Environment USER: #{Map.get(env, "USER")}") + Logger.debug("Environment HOME: #{Map.get(env, "HOME")}") + Logger.debug("Environment XDG_RUNTIME_DIR: #{Map.get(env, "XDG_RUNTIME_DIR")}") try do - case System.cmd(List.first(final_command), Enum.drop(final_command, 1), - stderr_to_stdout: true, timeout: timeout, env: env) do + task = Task.async(fn -> + System.cmd(List.first(final_command), Enum.drop(final_command, 1), + stderr_to_stdout: true, env: env) + end) + + case Task.await(task, timeout) do {output, 0} -> execution_time = System.monotonic_time(:millisecond) - start_time Logger.info("Command completed successfully in #{execution_time}ms")