I've seen the same issue on my configuration which has a corporate firewall.
If you can get the Package.swift established and make changes directly to it, you can go to the terminal and do something like
xcodebuild -resolveDependencies
Here you can control those env variables and make terminal abide by them.
Problem still exists around the other item though unfortunately.
I'm creating a ticket for it, you should too.