summary refs log tree commit diff
path: root/nixos/doc/manual/man-nixos-install.xml
blob: 0ebee7d23f9b2f371faf7edd59ed769deb76472e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<refentry xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xi="http://www.w3.org/2001/XInclude">

<refmeta>
  <refentrytitle><command>nixos-install</command></refentrytitle>
  <manvolnum>8</manvolnum>
  <refmiscinfo class="source">NixOS</refmiscinfo>
  <!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
</refmeta>

<refnamediv>
  <refname><command>nixos-install</command></refname>
  <refpurpose>install NixOS</refpurpose>
</refnamediv>

<refsynopsisdiv>
  <cmdsynopsis>
    <command>nixos-install</command>
  </cmdsynopsis>
</refsynopsisdiv>


<refsection><title>Description</title>

<para>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:

<itemizedlist>

  <listitem><para>It copies Nix and its dependencies to
  <filename>/mnt/nix/store</filename>.</para></listitem>

  <listitem><para>It runs Nix in <filename>/mnt</filename> to build
  the NixOS configuration specified in
  <filename>/mnt/etc/nixos/configuration.nix</filename>.</para></listitem>

  <listitem><para>It installs the GRUB boot loader on the device
  specified in the option <option>boot.loader.grub.device</option>,
  and generates a GRUB configuration file that boots into the NixOS
  configuration just installed.</para></listitem>

  <listitem><para>It prompts you for a password for the root
  account.</para></listitem>

</itemizedlist>

</para>

<para>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.</para>

</refsection>


<refsection><title>Examples</title>

<para>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>:

<screen>
$ mkfs.ext4 /dev/sda1
$ mount /dev/sda1 /mnt
$ nixos-generate-config --root /mnt
$ # edit /mnt/etc/nixos/configuration.nix
$ nixos-install
</screen>

</para>

</refsection>

</refentry>