diff --git a/nix/nixos-module.nix b/nix/nixos-module.nix index 71b2e88..8049a6c 100644 --- a/nix/nixos-module.nix +++ b/nix/nixos-module.nix @@ -79,8 +79,6 @@ 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"; }; @@ -95,6 +93,8 @@ in StandardError = "journal"; SyslogIdentifier = "systant"; WorkingDirectory = "${cfg.package}"; + # Import environment from user session + ExecStartPre = "${pkgs.systemd}/bin/systemctl --user import-environment PATH XDG_RUNTIME_DIR WAYLAND_DISPLAY"; }; }; }; diff --git a/server/lib/systant/command_executor.ex b/server/lib/systant/command_executor.ex index 6257b75..094ae1b 100644 --- a/server/lib/systant/command_executor.ex +++ b/server/lib/systant/command_executor.ex @@ -199,13 +199,8 @@ defmodule Systant.CommandExecutor do # Get current environment env = System.get_env() - # Ensure we have a proper PATH that includes system binaries - system_path = "/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/bin" - current_path = Map.get(env, "PATH", "") - full_path = if current_path == "", do: system_path, else: "#{current_path}:#{system_path}" - - # Start with enhanced environment - enhanced_env = Map.put(env, "PATH", full_path) + # Start with current environment + enhanced_env = env # If running as root, add Wayland session environment for user commands if System.get_env("USER") == "root" do