about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVenkateswara Rao Mandela <venkat.mandela@gmail.com>2018-09-01 19:42:35 +0530
committerxeji <36407913+xeji@users.noreply.github.com>2018-09-01 16:12:35 +0200
commitcb1ca420092c8854592afcf1cc0245b7245358f1 (patch)
tree7a7b846bf9b1194face6890131dadd49162f9a1c
parentff679f86a25dbf8c5997476a841a5a1127fa868e (diff)
downloadnixlib-cb1ca420092c8854592afcf1cc0245b7245358f1.tar
nixlib-cb1ca420092c8854592afcf1cc0245b7245358f1.tar.gz
nixlib-cb1ca420092c8854592afcf1cc0245b7245358f1.tar.bz2
nixlib-cb1ca420092c8854592afcf1cc0245b7245358f1.tar.lz
nixlib-cb1ca420092c8854592afcf1cc0245b7245358f1.tar.xz
nixlib-cb1ca420092c8854592afcf1cc0245b7245358f1.tar.zst
nixlib-cb1ca420092c8854592afcf1cc0245b7245358f1.zip
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.
-rw-r--r--nixos/doc/manual/installation/installing-behind-a-proxy.xml47
-rw-r--r--nixos/doc/manual/installation/installing.xml1
-rwxr-xr-x[-rw-r--r--]nixos/modules/installer/tools/nixos-generate-config.pl4
-rw-r--r--nixos/modules/system/activation/top-level.nix7
4 files changed, 59 insertions, 0 deletions
diff --git a/nixos/doc/manual/installation/installing-behind-a-proxy.xml b/nixos/doc/manual/installation/installing-behind-a-proxy.xml
new file mode 100644
index 000000000000..c59d073c61c7
--- /dev/null
+++ b/nixos/doc/manual/installation/installing-behind-a-proxy.xml
@@ -0,0 +1,47 @@
+<section xmlns="http://docbook.org/ns/docbook"
+         xmlns:xlink="http://www.w3.org/1999/xlink"
+         xmlns:xi="http://www.w3.org/2001/XInclude"
+         version="5.0"
+         xml:id="sec-installing-behind-proxy">
+ <title>Installing behind a proxy</title>
+
+<para>
+  To install NixOS behind a proxy, do the following before running
+  <literal>nixos-install</literal>.
+</para>
+<orderedlist numeration="arabic">
+  <listitem>
+    <para>
+      Update proxy configuration in
+      <literal>/mnt/etc/nixos/configuration.nix</literal> to keep the
+      internet accessible after reboot.
+    </para>
+    <programlisting>
+networking.proxy.default = &quot;http://user:password@proxy:port/&quot;;
+networking.proxy.noProxy = &quot;127.0.0.1,localhost,internal.domain&quot;;
+</programlisting>
+  </listitem>
+  <listitem>
+    <para>
+      Setup the proxy environment variables in the shell where you are
+      running <literal>nixos-install</literal>.
+    </para>
+    <programlisting>
+# proxy_url=&quot;http://user:password@proxy:port/&quot;
+# export http_proxy=&quot;$proxy_url&quot;
+# export HTTP_PROXY=&quot;$proxy_url&quot;
+# export https_proxy=&quot;$proxy_url&quot;
+# export HTTPS_PROXY=&quot;$proxy_url&quot;
+</programlisting>
+  </listitem>
+</orderedlist>
+
+<note>
+<para>
+  If you are switching networks with different proxy configurations, use the
+  <literal>nesting.clone</literal> option in
+  <literal>configuration.nix</literal> to switch proxies at runtime.
+  Refer to <xref linkend="ch-options" /> for more information.
+</para>
+</note>
+</section>
diff --git a/nixos/doc/manual/installation/installing.xml b/nixos/doc/manual/installation/installing.xml
index 6f8e0f613b19..916384559e24 100644
--- a/nixos/doc/manual/installation/installing.xml
+++ b/nixos/doc/manual/installation/installing.xml
@@ -443,4 +443,5 @@ $ nix-env -i w3m</screen>
  <xi:include href="installing-pxe.xml" />
  <xi:include href="installing-virtualbox-guest.xml" />
  <xi:include href="installing-from-other-distro.xml" />
+ <xi:include href="installing-behind-a-proxy.xml" />
 </chapter>
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index bb201d97ded1..04678c919c22 100644..100755
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -574,6 +574,10 @@ $bootLoaderConfig
   # networking.hostName = "nixos"; # Define your hostname.
   # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
 
+  # Configure network proxy if necessary
+  # networking.proxy.default = "http://user:password@proxy:port/";
+  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
+
   # Select internationalisation properties.
   # i18n = {
   #   consoleFont = "Lat2-Terminus16";
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index 9d410a8b9ca4..fff88e2c2bf3 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -162,6 +162,13 @@ in
       description = ''
         Additional configurations to build based on the current
         configuration which then has a lower priority.
+
+        To switch to a cloned configuration (e.g. <literal>child-1</literal>)
+        at runtime, run
+
+        <programlisting>
+        # sudo /run/current-system/fine-tune/child-1/bin/switch-to-configuration test
+        </programlisting>
       '';
     };