at 18.03-beta 3.0 kB view raw
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 5<refmeta> 6 <refentrytitle><command>nixos-enter</command></refentrytitle> 7 <manvolnum>8</manvolnum> 8 <refmiscinfo class="source">NixOS</refmiscinfo> 9 <!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> --> 10</refmeta> 11 12<refnamediv> 13 <refname><command>nixos-enter</command></refname> 14 <refpurpose>run a command in a NixOS chroot environment</refpurpose> 15</refnamediv> 16 17<refsynopsisdiv> 18 <cmdsynopsis> 19 <command>nixos-enter</command> 20 <arg> 21 <arg choice='plain'><option>--root</option></arg> 22 <replaceable>root</replaceable> 23 </arg> 24 <arg> 25 <arg choice='plain'><option>--system</option></arg> 26 <replaceable>system</replaceable> 27 </arg> 28 <arg> 29 <arg choice='plain'><option>-c</option></arg> 30 <replaceable>shell-command</replaceable> 31 </arg> 32 <arg> 33 <arg choice='plain'><option>--help</option></arg> 34 </arg> 35 <arg> 36 <arg choice='plain'><option>--</option></arg> 37 <replaceable>arguments</replaceable> 38 </arg> 39 </cmdsynopsis> 40</refsynopsisdiv> 41 42 43<refsection><title>Description</title> 44 45<para>This command runs a command in a NixOS chroot environment, that 46is, in a filesystem hierarchy previously prepared using 47<command>nixos-install</command>.</para> 48 49</refsection> 50 51<refsection><title>Options</title> 52 53<para>This command accepts the following options:</para> 54 55<variablelist> 56 57 <varlistentry> 58 <term><option>--root</option></term> 59 <listitem> 60 <para>The path to the NixOS system you want to enter. It defaults to <filename>/mnt</filename>.</para> 61 </listitem> 62 </varlistentry> 63 64 <varlistentry> 65 <term><option>--system</option></term> 66 <listitem> 67 <para>The NixOS system configuration to use. It defaults to 68 <filename>/nix/var/nix/profiles/system</filename>. You can enter 69 a previous NixOS configuration by specifying a path such as 70 <filename>/nix/var/nix/profiles/system-106-link</filename>.</para> 71 </listitem> 72 </varlistentry> 73 74 <varlistentry> 75 <term><option>--command</option></term> 76 <term><option>-c</option></term> 77 <listitem> 78 <para>The bash command to execute.</para> 79 </listitem> 80 </varlistentry> 81 82 <varlistentry> 83 <term><option>--</option></term> 84 85 <listitem><para>Interpret the remaining arguments as the program 86 name and arguments to be invoked. The program is not executed in a 87 shell.</para></listitem> 88 89 </varlistentry> 90 91</variablelist> 92 93</refsection> 94 95 96<refsection><title>Examples</title> 97 98<para>Start an interactive shell in the NixOS installation in 99<filename>/mnt</filename>:</para> 100 101<screen> 102# nixos-enter /mnt 103</screen> 104 105<para>Run a shell command:</para> 106 107<screen> 108# nixos-enter -c 'ls -l /; cat /proc/mounts' 109</screen> 110 111<para>Run a non-shell command:</para> 112 113<screen> 114# nixos-enter -- cat /proc/mounts 115</screen> 116 117</refsection> 118 119</refentry>