From 9d8c3b4e345f068a7746fda5ea0dd28d6f18043b Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Sun, 13 Sep 2026 13:26:49 +0800 Subject: [PATCH] fix: preserve environment in systemd launch --- .gitignore | 2 -- crates/openconnect/build.rs | 5 +---- flake.nix | 5 +++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 712731d..6d553be 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,3 @@ gen # Nix files result - -.DS_Store diff --git a/crates/openconnect/build.rs b/crates/openconnect/build.rs index c723ff9..daf79a5 100644 --- a/crates/openconnect/build.rs +++ b/crates/openconnect/build.rs @@ -117,10 +117,7 @@ fn build_openconnect(deps_dir: &PathBuf, out_dir: &PathBuf) -> PathBuf { #[cfg(target_os = "macos")] { - config - .disable_static() - .enable_shared() - .without("gnutls", None); + config.disable_static().enable_shared().without("gnutls", None); config.ldflag("-liconv"); config.env("LIBS", "-liconv"); } diff --git a/flake.nix b/flake.nix index 3358d87..6198a5f 100644 --- a/flake.nix +++ b/flake.nix @@ -297,14 +297,15 @@ --service-type=exec ) - while IFS= read -r env_name; do + while IFS= read -r -d "" env_entry; do + env_name="''${env_entry%%=*}" case "$env_name" in *[!A-Za-z0-9_]* | [0-9]* | PATH | GP_VPNC_SCRIPT_INSTALLER_BINARY | INVOCATION_ID | JOURNAL_STREAM | LISTEN_* | NOTIFY_SOCKET | SYSTEMD_EXEC_PID) continue ;; esac systemd_run_args+=("--setenv=$env_name") - done < <(compgen -e) + done < <(${pkgs.coreutils}/bin/env --null) gui_path="/run/wrappers/bin:''${PATH:-}" systemd_run_args+=(