git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/doc: add instructions for installation behind a proxy (#45854)

The instructions to install nixos behind a proxy were not clear. While one could guess that setting http_proxy variables can get the install rolling, one could end up with an installed system where the proxy settings for the nix-daemon are not configured. This commit updates the documentation with 1. steps to install behind a proxy 2. configure the global proxy settings so that nix-daemon can access internet. 3. Pointers to use nesting.clone in case one has to use different proxy settings on different networks.

commitcb1ca420092c8854592afcf1cc0245b7245358f1 authorVenkateswara Rao Mandela <venkat.mandela@gmail.com> dateSat 1 Sep 2018, 19:42 (8 years ago) parentff679f8
4 files changed+59
nixos/doc/manual/installation/installing-behind-a-proxy.xml+47 nixos/doc/manual/installation/installing.xml+1 nixos/modules/installer/tools/nixos-generate-config.pl+4 nixos/modules/system/activation/top-level.nix+7
nixos/doc/manual/installation/installing-behind-a-proxy.xmlnew file+47
@@ -0,0 +1,47 @@
1+<section xmlns="http://docbook.org/ns/docbook"
2+ xmlns:xlink="http://www.w3.org/1999/xlink"
3+ xmlns:xi="http://www.w3.org/2001/XInclude"
4+ version="5.0"
5+ xml:id="sec-installing-behind-proxy">
6+ <title>Installing behind a proxy</title>
7+
8+<para>
9+ To install NixOS behind a proxy, do the following before running
10+ <literal>nixos-install</literal>.
11+</para>
12+<orderedlist numeration="arabic">
13+ <listitem>
14+ <para>
15+ Update proxy configuration in
16+ <literal>/mnt/etc/nixos/configuration.nix</literal> to keep the
17+ internet accessible after reboot.
18+ </para>
19+ <programlisting>
20+networking.proxy.default = &quot;http://user:password@proxy:port/&quot;;
21+networking.proxy.noProxy = &quot;127.0.0.1,localhost,internal.domain&quot;;
22+</programlisting>
23+ </listitem>
24+ <listitem>
25+ <para>
26+ Setup the proxy environment variables in the shell where you are
27+ running <literal>nixos-install</literal>.
28+ </para>
29+ <programlisting>
30+# proxy_url=&quot;http://user:password@proxy:port/&quot;
31+# export http_proxy=&quot;$proxy_url&quot;
32+# export HTTP_PROXY=&quot;$proxy_url&quot;
33+# export https_proxy=&quot;$proxy_url&quot;
34+# export HTTPS_PROXY=&quot;$proxy_url&quot;
35+</programlisting>
36+ </listitem>
37+</orderedlist>
38+
39+<note>
40+<para>
41+ If you are switching networks with different proxy configurations, use the
42+ <literal>nesting.clone</literal> option in
43+ <literal>configuration.nix</literal> to switch proxies at runtime.
44+ Refer to <xref linkend="ch-options" /> for more information.
45+</para>
46+</note>
47+</section>
nixos/doc/manual/installation/installing.xml+1
@@ -443,4 +443,5 @@ $ nix-env -i w3m</screen>
443443 <xi:include href="installing-pxe.xml" />
444444 <xi:include href="installing-virtualbox-guest.xml" />
445445 <xi:include href="installing-from-other-distro.xml" />
446+ <xi:include href="installing-behind-a-proxy.xml" />
446447</chapter>
nixos/modules/installer/tools/nixos-generate-config.plmode 100644 → 100755+4
@@ -574,6 +574,10 @@ $bootLoaderConfig
574574 # networking.hostName = "nixos"; # Define your hostname.
575575 # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
576576
577+ # Configure network proxy if necessary
578+ # networking.proxy.default = "http://user:password@proxy:port/";
579+ # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
580+
577581 # Select internationalisation properties.
578582 # i18n = {
579583 # consoleFont = "Lat2-Terminus16";
nixos/modules/system/activation/top-level.nix+7
@@ -162,6 +162,13 @@ in
162162 description = ''
163163 Additional configurations to build based on the current
164164 configuration which then has a lower priority.
165+
166+ To switch to a cloned configuration (e.g. <literal>child-1</literal>)
167+ at runtime, run
168+
169+ <programlisting>
170+ # sudo /run/current-system/fine-tune/child-1/bin/switch-to-configuration test
171+ </programlisting>
165172 '';
166173 };
167174