[Nix-dev] Setting proxy environmental variables

masterdeZign masterdezign at gmail.com
Thu Nov 27 11:43:47 CET 2014


Dear Edward and Wout,

thank you for your replies.

Edward, I more or less understand what your script tries to do
https://github.com/edwtjo/nixin/blob/master/nixin#L103-L124. But can you
advise which values for NIXPKGS_REPO are suitable? I am using a 14.04
virtualbox image for now and it does not have git installed.

Wout, I have already set the http_proxy and https_proxy environmental
variables (written in the very first message). Unfortunately, it is not
enough, that's why this question thread.

To summarize, steps taken:

1) export http_proxy=some-proxy.com:3128 --- OK
2) export https_proxy=some-proxy.com:3128 --- OK
3) export NIX_REMOTE=""  --- OK
4) export NIXPKGS_REPO=  --- ???
5) rebuilding nixos --- ??? (fails because no proxy found)

Thank you!


2014-11-24 17:14 GMT+01:00 Edward Tjörnhammar <ed at cflags.cc>:

> On Thu, Nov 20, 2014 at 03:07:19PM +0100, masterdeZign wrote:
> > 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.
>
> Exactly. NIX_REMOTE is set to daemon and you need to unset it so that
> the nix*-utils inherits those vars:
>
> export NIX_REMOTE=""
> export http_proxy=$1
>
> meaning that root gets a HTTP proxy to communicate through and that
> she shan't make RPC calls to the nix-worker but build herself.
>
> This interim proxy subject can be found at:
>
>   *
> https://lastlog.de/wiki/index.php/Nixos_configuration.nix#nixos_with_proxy
>       - You also need to unset binary-caches since those fetches
>         didn't honour the proxyvars when I needed an interim proxy.
>   * https://github.com/edwtjo/nixin/blob/master/nixin#L103-L124
>       - My own hack. Example of disabled binary-caches when setting or
>         unsetting a system proxy. Also note that I don't recommend
>         using that script, it is just an example usage.
>
> >
> > Looking around the manual, I have found nix.proxy configuration
> > string. I have ended up with a /etc/nixos/configuration.nix like that:
>
> nix.proxy will set the http_proxy upon the next activation, which happens
> after a nixos-rebuild switch. You need to use an interim proxy to actually
> do that, as described above. You also don't want to update the build
> expressions, nix-channel or git fetch, in order to keep the system
> switch rebuild small.
>
> >
> > { 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.
> > _______________________________________________
> > nix-dev mailing list
> > nix-dev at lists.science.uu.nl
> > http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
> Regards
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20141127/ad11b7ec/attachment-0001.html 


More information about the nix-dev mailing list