How to set proxy for Nix building Go packages?

I am using NixOS 23.11. And I have trouble installing packages like “terraform”.

I need to use a https_proxy to download those Go mods. It worked as networking.proxy.httpsProxy. But it affected other parts. So I’d like it to be only for Nix.

I set systemd.services.nix-daemon.environment to { HTTPS_PROXY = "xxx" } and it appeared in /etc/systemd/system/nix-daemon.service.d/overrides.conf. But Go still did not work.

sudo ps axfeeww showed that the env only affects nix-daemon, but not its child process go.

What should I do?