[Nix-dev] Setting proxy environmental variables

masterdeZign masterdezign at gmail.com
Thu Nov 20 15:07:19 CET 2014


Hello!

I am new to NixOs, but the question which interests me seems not to be
discussed yet.
My workstation has access to Internet via proxy. I have exported
environmental variables http_proxy and https_proxy, however running
nix-env -i wget fails accessing cache.nixos.org and subsequently,
tarballs.nixos.org. I suspect it's due to the fact the build users do
not share the environmental variables with my current user.

Looking around the manual, I have found nix.proxy configuration
string. I have ended up with a /etc/nixos/configuration.nix like that:

{ config, pkgs, ... }:

{
  imports = [ <nixos/modules/installer/virtualbox-demo.nix>
                    <nixpkgs/nixos/modules/services/misc/nix-daemon.nix>
               ];

 nix.proxy = "proxy-host.com:3128";

}

However nixos-rebuild switch fails in the same way as nix-env -i:

building Nix...
building the system configuration...
download-from-binary-cache.pl: still waiting for
‘http://cache.nixos.org/nix-cache-info’ after 5 seconds...
download-from-binary-cache.pl: could not download
‘http://cache.nixos.org/nix-cache-info’ (Curl error 7)
these derivations will be built:
  /nix/store/17s184bdsmnqa0vpwxmyj58i3a2n8flz-dbus-conf.drv
  /nix/store/2jwpim2m9f4yhi1ds0rqqcl6h623v0b5-stdenv.drv
  /nix/store/3xbm6viqjdpznhxxxqpsirlfjz0b64lw-bzip2.drv
...
  /nix/store/zw9nnsyygzz72j5b3j5zw4bknzkcbcdf-docbook-5.0.zip.drv
building path(s) `/nix/store/4fxls0b5l7c3kdd8idbzr6cp823iip37-bzip2'
downloading http://tarballs.nixos.org/stdenv-linux/i686/r24519/bzip2
into /nix/store/4fxls0b5l7c3kdd8idbzr6cp823iip37-bzip2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:02:07 --:--:--



Thank you in advance.


More information about the nix-dev mailing list