2013-10-13 16:57:09 +02:00
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook"
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
xmlns:xi="http://www.w3.org/2001/XInclude">
|
2018-05-02 01:57:09 +02:00
|
|
|
<refmeta>
|
|
|
|
<refentrytitle><command>nixos-install</command>
|
|
|
|
</refentrytitle><manvolnum>8</manvolnum>
|
2013-10-13 16:57:09 +02:00
|
|
|
<refmiscinfo class="source">NixOS</refmiscinfo>
|
2018-05-02 01:57:09 +02:00
|
|
|
<!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
|
|
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
2019-10-05 17:48:30 +02:00
|
|
|
<refname><command>nixos-install</command></refname>
|
|
|
|
<refpurpose>install bootloader and NixOS</refpurpose>
|
2018-05-02 01:57:09 +02:00
|
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
2018-06-01 03:03:51 +02:00
|
|
|
<cmdsynopsis>
|
2019-09-19 19:17:30 +02:00
|
|
|
<command>nixos-install</command>
|
2019-12-22 22:03:14 +01:00
|
|
|
<arg>
|
|
|
|
<group choice='req'>
|
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--verbose</option>
|
|
|
|
</arg>
|
|
|
|
<arg choice='plain'>
|
|
|
|
<option>-v</option>
|
|
|
|
</arg>
|
|
|
|
</group>
|
|
|
|
</arg>
|
2018-05-02 01:57:09 +02:00
|
|
|
<arg>
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>-I</option>
|
|
|
|
</arg>
|
|
|
|
<replaceable>path</replaceable>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-05-02 01:57:09 +02:00
|
|
|
<arg>
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--root</option>
|
|
|
|
</arg>
|
|
|
|
<replaceable>root</replaceable>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-05-02 01:57:09 +02:00
|
|
|
<arg>
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--system</option>
|
|
|
|
</arg>
|
|
|
|
<replaceable>path</replaceable>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2020-08-11 18:15:28 +02:00
|
|
|
<arg>
|
|
|
|
<option>--flake</option> <replaceable>flake-uri</replaceable>
|
|
|
|
</arg>
|
|
|
|
|
2020-10-10 10:05:15 +02:00
|
|
|
<arg>
|
|
|
|
<group choice='req'>
|
|
|
|
<arg choice='plain'><option>--impure</option></arg>
|
|
|
|
</group>
|
|
|
|
</arg>
|
|
|
|
|
2020-01-03 11:30:55 +01:00
|
|
|
<arg>
|
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--channel</option>
|
|
|
|
</arg>
|
|
|
|
<replaceable>channel</replaceable>
|
|
|
|
</arg>
|
|
|
|
|
2018-05-02 01:57:09 +02:00
|
|
|
<arg>
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--no-channel-copy</option>
|
2015-01-06 14:49:18 +01:00
|
|
|
</arg>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-05-02 01:57:09 +02:00
|
|
|
<arg>
|
2021-10-04 21:05:23 +02:00
|
|
|
<group choice='req'>
|
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--no-root-password</option>
|
|
|
|
</arg>
|
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--no-root-passwd</option>
|
|
|
|
</arg>
|
|
|
|
</group>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-05-02 01:57:09 +02:00
|
|
|
<arg>
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--no-bootloader</option>
|
2016-07-24 15:45:24 +02:00
|
|
|
</arg>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
<group choice='req'>
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--max-jobs</option>
|
2016-07-24 15:45:24 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>-j</option>
|
|
|
|
</arg>
|
2018-06-01 03:07:15 +02:00
|
|
|
</group> <replaceable>number</replaceable>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg>
|
2018-06-01 03:07:15 +02:00
|
|
|
<option>--cores</option> <replaceable>number</replaceable>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg>
|
2018-06-01 03:07:15 +02:00
|
|
|
<option>--option</option> <replaceable>name</replaceable> <replaceable>value</replaceable>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2018-05-02 01:57:09 +02:00
|
|
|
<arg>
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--show-trace</option>
|
2016-07-24 15:45:24 +02:00
|
|
|
</arg>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2019-09-19 19:17:30 +02:00
|
|
|
|
2020-10-14 22:45:22 +02:00
|
|
|
<arg>
|
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--keep-going</option>
|
|
|
|
</arg>
|
|
|
|
</arg>
|
|
|
|
|
2018-05-02 01:57:09 +02:00
|
|
|
<arg>
|
2018-06-01 03:03:51 +02:00
|
|
|
<arg choice='plain'>
|
|
|
|
<option>--help</option>
|
2015-01-06 14:49:18 +01:00
|
|
|
</arg>
|
2018-05-02 01:57:09 +02:00
|
|
|
</arg>
|
2013-10-13 16:57:09 +02:00
|
|
|
</cmdsynopsis>
|
2018-05-02 01:57:09 +02:00
|
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
|
|
<title>Description</title>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
This command installs NixOS in the file system mounted on
|
|
|
|
<filename>/mnt</filename>, based on the NixOS configuration specified in
|
|
|
|
<filename>/mnt/etc/nixos/configuration.nix</filename>. It performs the
|
|
|
|
following steps:
|
2018-05-02 01:57:09 +02:00
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
It copies Nix and its dependencies to
|
|
|
|
<filename>/mnt/nix/store</filename>.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
It runs Nix in <filename>/mnt</filename> to build the NixOS configuration
|
|
|
|
specified in <filename>/mnt/etc/nixos/configuration.nix</filename>.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
2020-01-03 11:30:55 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
It installs the current channel <quote>nixos</quote> in the target channel
|
|
|
|
profile (unless <option>--no-channel-copy</option> is specified).
|
|
|
|
</para>
|
|
|
|
</listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
It installs the GRUB boot loader on the device specified in the option
|
|
|
|
<option>boot.loader.grub.device</option> (unless
|
|
|
|
<option>--no-bootloader</option> is specified), and generates a GRUB
|
|
|
|
configuration file that boots into the NixOS configuration just
|
|
|
|
installed.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
It prompts you for a password for the root account (unless
|
2021-10-04 21:05:23 +02:00
|
|
|
<option>--no-root-password</option> is specified).
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
</para>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
This command is idempotent: if it is interrupted or fails due to a temporary
|
|
|
|
problem (e.g. a network issue), you can safely re-run it.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</refsection>
|
|
|
|
<refsection>
|
|
|
|
<title>Options</title>
|
|
|
|
<para>
|
|
|
|
This command accepts the following options:
|
|
|
|
</para>
|
|
|
|
<variablelist>
|
2019-12-22 22:03:14 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>--verbose</option> / <option>-v</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>Increases the level of verbosity of diagnostic messages
|
|
|
|
printed on standard error. For each Nix operation, the information
|
|
|
|
printed on standard output is well-defined; any diagnostic
|
|
|
|
information is printed on standard error, never on standard
|
|
|
|
output.</para>
|
|
|
|
<para>Please note that this option may be specified repeatedly.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2018-05-02 01:57:09 +02:00
|
|
|
<varlistentry>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
|
|
|
<option>--root</option>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
Defaults to <filename>/mnt</filename>. If this option is given, treat the
|
|
|
|
directory <replaceable>root</replaceable> as the root of the NixOS
|
|
|
|
installation.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
|
|
|
<option>--system</option>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
If this option is provided, <command>nixos-install</command> will install
|
|
|
|
the specified closure rather than attempt to build one from
|
|
|
|
<filename>/mnt/etc/nixos/configuration.nix</filename>.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
The closure must be an appropriately configured NixOS system, with boot
|
|
|
|
loader and partition configuration that fits the target host. Such a
|
|
|
|
closure is typically obtained with a command such as <command>nix-build
|
2020-01-15 05:39:12 +01:00
|
|
|
-I nixos-config=./configuration.nix '<nixpkgs/nixos>' -A system
|
2019-09-19 19:17:30 +02:00
|
|
|
--no-out-link</command>
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2020-08-11 18:15:28 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<option>--flake</option> <replaceable>flake-uri</replaceable>#<replaceable>name</replaceable>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Build the NixOS system from the specified flake.
|
|
|
|
The flake must contain an output named
|
|
|
|
<literal>nixosConfigurations.<replaceable>name</replaceable></literal>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2020-01-03 11:30:55 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<option>--channel</option>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If this option is provided, do not copy the current
|
|
|
|
<quote>nixos</quote> channel to the target host. Instead, use the
|
|
|
|
specified derivation.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2018-05-02 01:57:09 +02:00
|
|
|
<varlistentry>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
|
|
|
<option>-I</option>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
Add a path to the Nix expression search path. This option may be given
|
|
|
|
multiple times. See the NIX_PATH environment variable for information on
|
|
|
|
the semantics of the Nix search path. Paths added through
|
|
|
|
<replaceable>-I</replaceable> take precedence over NIX_PATH.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
|
|
|
<option>--max-jobs</option>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
|
|
|
<option>-j</option>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
2015-01-06 14:49:18 +01:00
|
|
|
<listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
Sets the maximum number of build jobs that Nix will perform in parallel
|
|
|
|
to the specified number. The default is <literal>1</literal>. A higher
|
|
|
|
value is useful on SMP systems or to exploit I/O latency.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
2016-07-24 15:45:24 +02:00
|
|
|
</listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
|
|
|
<option>--cores</option>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
2016-07-24 15:45:24 +02:00
|
|
|
<listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
Sets the value of the <envar>NIX_BUILD_CORES</envar> environment variable
|
|
|
|
in the invocation of builders. Builders can use this variable at their
|
|
|
|
discretion to control the maximum amount of parallelism. For instance, in
|
|
|
|
Nixpkgs, if the derivation attribute
|
|
|
|
<varname>enableParallelBuilding</varname> is set to
|
|
|
|
<literal>true</literal>, the builder passes the
|
|
|
|
<option>-j<replaceable>N</replaceable></option> flag to GNU Make. The
|
|
|
|
value <literal>0</literal> means that the builder should use all
|
|
|
|
available CPU cores in the system.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
2015-01-06 14:49:18 +01:00
|
|
|
</listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
2018-06-01 03:07:15 +02:00
|
|
|
<option>--option</option> <replaceable>name</replaceable> <replaceable>value</replaceable>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
2015-01-06 14:49:18 +01:00
|
|
|
<listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
Set the Nix configuration option <replaceable>name</replaceable> to
|
|
|
|
<replaceable>value</replaceable>.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
2015-01-06 14:49:18 +01:00
|
|
|
</listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
|
|
|
<option>--show-trace</option>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
2015-01-06 14:49:18 +01:00
|
|
|
<listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
Causes Nix to print out a stack trace in case of Nix expression
|
|
|
|
evaluation errors.
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
2020-10-14 22:45:22 +02:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<option>--keep-going</option>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Causes Nix to continue building derivations as far as possible
|
|
|
|
in the face of failed builds.
|
|
|
|
</para>
|
2015-01-06 14:49:18 +01:00
|
|
|
</listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2018-06-01 03:03:51 +02:00
|
|
|
<term>
|
|
|
|
<option>--help</option>
|
2018-05-02 01:57:09 +02:00
|
|
|
</term>
|
2015-01-06 14:49:18 +01:00
|
|
|
<listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
<para>
|
|
|
|
Synonym for <command>man nixos-install</command>.
|
|
|
|
</para>
|
2015-01-06 14:49:18 +01:00
|
|
|
</listitem>
|
2018-05-02 01:57:09 +02:00
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsection>
|
|
|
|
<refsection>
|
|
|
|
<title>Examples</title>
|
|
|
|
<para>
|
2019-09-19 19:17:30 +02:00
|
|
|
A typical NixOS installation is done by creating and mounting a file system
|
|
|
|
on <filename>/mnt</filename>, generating a NixOS configuration in
|
|
|
|
<filename>/mnt/etc/nixos/configuration.nix</filename>, and running
|
|
|
|
<command>nixos-install</command>. For instance, if we want to install NixOS
|
|
|
|
on an <literal>ext4</literal> file system created in
|
|
|
|
<filename>/dev/sda1</filename>:
|
2013-10-13 16:57:09 +02:00
|
|
|
<screen>
|
2019-06-17 13:25:50 +02:00
|
|
|
<prompt>$ </prompt>mkfs.ext4 /dev/sda1
|
|
|
|
<prompt>$ </prompt>mount /dev/sda1 /mnt
|
|
|
|
<prompt>$ </prompt>nixos-generate-config --root /mnt
|
|
|
|
<prompt>$ </prompt># edit /mnt/etc/nixos/configuration.nix
|
|
|
|
<prompt>$ </prompt>nixos-install
|
|
|
|
<prompt>$ </prompt>reboot
|
2013-10-13 16:57:09 +02:00
|
|
|
</screen>
|
2018-05-02 01:57:09 +02:00
|
|
|
</para>
|
|
|
|
</refsection>
|
2013-10-13 16:57:09 +02:00
|
|
|
</refentry>
|