You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

man-nixos-install.xml 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <refentry 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. <refmeta>
  5. <refentrytitle><command>nixos-install</command>
  6. </refentrytitle><manvolnum>8</manvolnum>
  7. <refmiscinfo class="source">NixOS</refmiscinfo>
  8. <!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
  9. </refmeta>
  10. <refnamediv>
  11. <refname><command>nixos-install</command></refname>
  12. <refpurpose>install bootloader and NixOS</refpurpose>
  13. </refnamediv>
  14. <refsynopsisdiv>
  15. <cmdsynopsis>
  16. <command>nixos-install</command>
  17. <arg>
  18. <arg choice='plain'>
  19. <option>-I</option>
  20. </arg>
  21. <replaceable>path</replaceable>
  22. </arg>
  23. <arg>
  24. <arg choice='plain'>
  25. <option>--root</option>
  26. </arg>
  27. <replaceable>root</replaceable>
  28. </arg>
  29. <arg>
  30. <arg choice='plain'>
  31. <option>--system</option>
  32. </arg>
  33. <replaceable>path</replaceable>
  34. </arg>
  35. <arg>
  36. <arg choice='plain'>
  37. <option>--no-channel-copy</option>
  38. </arg>
  39. </arg>
  40. <arg>
  41. <arg choice='plain'>
  42. <option>--no-root-passwd</option>
  43. </arg>
  44. </arg>
  45. <arg>
  46. <arg choice='plain'>
  47. <option>--no-bootloader</option>
  48. </arg>
  49. </arg>
  50. <arg>
  51. <group choice='req'>
  52. <arg choice='plain'>
  53. <option>--max-jobs</option>
  54. </arg>
  55. <arg choice='plain'>
  56. <option>-j</option>
  57. </arg>
  58. </group> <replaceable>number</replaceable>
  59. </arg>
  60. <arg>
  61. <option>--cores</option> <replaceable>number</replaceable>
  62. </arg>
  63. <arg>
  64. <option>--option</option> <replaceable>name</replaceable> <replaceable>value</replaceable>
  65. </arg>
  66. <arg>
  67. <arg choice='plain'>
  68. <option>--show-trace</option>
  69. </arg>
  70. </arg>
  71. <arg>
  72. <arg choice='plain'>
  73. <option>--help</option>
  74. </arg>
  75. </arg>
  76. </cmdsynopsis>
  77. </refsynopsisdiv>
  78. <refsection>
  79. <title>Description</title>
  80. <para>
  81. This command installs NixOS in the file system mounted on
  82. <filename>/mnt</filename>, based on the NixOS configuration specified in
  83. <filename>/mnt/etc/nixos/configuration.nix</filename>. It performs the
  84. following steps:
  85. <itemizedlist>
  86. <listitem>
  87. <para>
  88. It copies Nix and its dependencies to
  89. <filename>/mnt/nix/store</filename>.
  90. </para>
  91. </listitem>
  92. <listitem>
  93. <para>
  94. It runs Nix in <filename>/mnt</filename> to build the NixOS configuration
  95. specified in <filename>/mnt/etc/nixos/configuration.nix</filename>.
  96. </para>
  97. </listitem>
  98. <listitem>
  99. <para>
  100. It installs the GRUB boot loader on the device specified in the option
  101. <option>boot.loader.grub.device</option> (unless
  102. <option>--no-bootloader</option> is specified), and generates a GRUB
  103. configuration file that boots into the NixOS configuration just
  104. installed.
  105. </para>
  106. </listitem>
  107. <listitem>
  108. <para>
  109. It prompts you for a password for the root account (unless
  110. <option>--no-root-passwd</option> is specified).
  111. </para>
  112. </listitem>
  113. </itemizedlist>
  114. </para>
  115. <para>
  116. This command is idempotent: if it is interrupted or fails due to a temporary
  117. problem (e.g. a network issue), you can safely re-run it.
  118. </para>
  119. </refsection>
  120. <refsection>
  121. <title>Options</title>
  122. <para>
  123. This command accepts the following options:
  124. </para>
  125. <variablelist>
  126. <varlistentry>
  127. <term>
  128. <option>--root</option>
  129. </term>
  130. <listitem>
  131. <para>
  132. Defaults to <filename>/mnt</filename>. If this option is given, treat the
  133. directory <replaceable>root</replaceable> as the root of the NixOS
  134. installation.
  135. </para>
  136. </listitem>
  137. </varlistentry>
  138. <varlistentry>
  139. <term>
  140. <option>--system</option>
  141. </term>
  142. <listitem>
  143. <para>
  144. If this option is provided, <command>nixos-install</command> will install
  145. the specified closure rather than attempt to build one from
  146. <filename>/mnt/etc/nixos/configuration.nix</filename>.
  147. </para>
  148. <para>
  149. The closure must be an appropriately configured NixOS system, with boot
  150. loader and partition configuration that fits the target host. Such a
  151. closure is typically obtained with a command such as <command>nix-build
  152. -I nixos-config=./configuration.nix '&lt;nixos&gt;' -A system
  153. --no-out-link</command>
  154. </para>
  155. </listitem>
  156. </varlistentry>
  157. <varlistentry>
  158. <term>
  159. <option>-I</option>
  160. </term>
  161. <listitem>
  162. <para>
  163. Add a path to the Nix expression search path. This option may be given
  164. multiple times. See the NIX_PATH environment variable for information on
  165. the semantics of the Nix search path. Paths added through
  166. <replaceable>-I</replaceable> take precedence over NIX_PATH.
  167. </para>
  168. </listitem>
  169. </varlistentry>
  170. <varlistentry>
  171. <term>
  172. <option>--max-jobs</option>
  173. </term>
  174. <term>
  175. <option>-j</option>
  176. </term>
  177. <listitem>
  178. <para>
  179. Sets the maximum number of build jobs that Nix will perform in parallel
  180. to the specified number. The default is <literal>1</literal>. A higher
  181. value is useful on SMP systems or to exploit I/O latency.
  182. </para>
  183. </listitem>
  184. </varlistentry>
  185. <varlistentry>
  186. <term>
  187. <option>--cores</option>
  188. </term>
  189. <listitem>
  190. <para>
  191. Sets the value of the <envar>NIX_BUILD_CORES</envar> environment variable
  192. in the invocation of builders. Builders can use this variable at their
  193. discretion to control the maximum amount of parallelism. For instance, in
  194. Nixpkgs, if the derivation attribute
  195. <varname>enableParallelBuilding</varname> is set to
  196. <literal>true</literal>, the builder passes the
  197. <option>-j<replaceable>N</replaceable></option> flag to GNU Make. The
  198. value <literal>0</literal> means that the builder should use all
  199. available CPU cores in the system.
  200. </para>
  201. </listitem>
  202. </varlistentry>
  203. <varlistentry>
  204. <term>
  205. <option>--option</option> <replaceable>name</replaceable> <replaceable>value</replaceable>
  206. </term>
  207. <listitem>
  208. <para>
  209. Set the Nix configuration option <replaceable>name</replaceable> to
  210. <replaceable>value</replaceable>.
  211. </para>
  212. </listitem>
  213. </varlistentry>
  214. <varlistentry>
  215. <term>
  216. <option>--show-trace</option>
  217. </term>
  218. <listitem>
  219. <para>
  220. Causes Nix to print out a stack trace in case of Nix expression
  221. evaluation errors.
  222. </para>
  223. </listitem>
  224. </varlistentry>
  225. <varlistentry>
  226. <term>
  227. <option>--help</option>
  228. </term>
  229. <listitem>
  230. <para>
  231. Synonym for <command>man nixos-install</command>.
  232. </para>
  233. </listitem>
  234. </varlistentry>
  235. </variablelist>
  236. </refsection>
  237. <refsection>
  238. <title>Examples</title>
  239. <para>
  240. A typical NixOS installation is done by creating and mounting a file system
  241. on <filename>/mnt</filename>, generating a NixOS configuration in
  242. <filename>/mnt/etc/nixos/configuration.nix</filename>, and running
  243. <command>nixos-install</command>. For instance, if we want to install NixOS
  244. on an <literal>ext4</literal> file system created in
  245. <filename>/dev/sda1</filename>:
  246. <screen>
  247. <prompt>$ </prompt>mkfs.ext4 /dev/sda1
  248. <prompt>$ </prompt>mount /dev/sda1 /mnt
  249. <prompt>$ </prompt>nixos-generate-config --root /mnt
  250. <prompt>$ </prompt># edit /mnt/etc/nixos/configuration.nix
  251. <prompt>$ </prompt>nixos-install
  252. <prompt>$ </prompt>reboot
  253. </screen>
  254. </para>
  255. </refsection>
  256. </refentry>