I’m struggling to install NixOS behind a proxy. I’ve tried several approaches, but I keep hitting a wall where the Nix package manager can’t reach the binary caches.
My Setup:
Connection: Phone connected via Ethernet running a local proxy server.
Installer: NixOS Minimal Installer.
Environment Variables: I have set HTTP_PROXY, HTTPS_PROXY, and ALL_PROXY (both uppercase and lowercase).
The Problem:
Connectivity seems to work for standard tools, but fails for Nix:
Works:curl -I "https://cache.nixos.org" and curl -I "https://tarballs.nixos.org" both return a successful response.
Thanks. I’ll give it a shot but I don’t think it’ll work. The problem is that Nix is unable to detect my proxy. When I wanted to install Arch Linux, I just had to set the related environment variables and it just worked, but Nix isn’t working.
Since Nix allows non-root access to packages, it uses a daemon to do the most of the work. Therefore you may want to set the proxy on the systemd service instead.
Use sudo systemctl edit --runtime nix-daemon.service and write something like this, setting the exact variables you want to set:
After installation, you may want to set this up permanently with options under networking.proxy. However note that they will only apply after the first nixos-rebuild switch, since the configuration switch happens after building.