From 3a47e9e53f3e88a912e5ef0148f4f8bce5295f74 Mon Sep 17 00:00:00 2001 From: Zhongcheng Lao Date: Sat, 1 Jul 2023 22:27:50 +0800 Subject: [PATCH] Set proxy config for daemon during installation on Darwin Signed-off-by: Zhongcheng Lao --- scripts/install-darwin-multi-user.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/install-darwin-multi-user.sh b/scripts/install-darwin-multi-user.sh index 0326d3415..4555605f4 100644 --- a/scripts/install-darwin-multi-user.sh +++ b/scripts/install-darwin-multi-user.sh @@ -102,6 +102,14 @@ poly_configure_nix_daemon_service() { _sudo "to set up the nix-daemon as a LaunchDaemon" \ /usr/bin/install -m -rw-r--r-- "/nix/var/nix/profiles/default$NIX_DAEMON_DEST" "$NIX_DAEMON_DEST" + vars="http_proxy https_proxy ftp_proxy no_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY NO_PROXY" + for v in $vars; do + if [ "x${!v:-}" != "x" ]; then + _sudo "to set the ${v} setting for nix-daemon" \ + plutil -replace "EnvironmentVariables.${v}" -string "${!v}" "$NIX_DAEMON_DEST" + fi + done + _sudo "to load the LaunchDaemon plist for nix-daemon" \ launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist