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">
5 <refentrytitle><command>nixos-enter</command>
6 </refentrytitle><manvolnum>8</manvolnum>
7 <refmiscinfo class="source">NixOS</refmiscinfo>
8 <!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
11 <refname><command>nixos-enter</command></refname>
12 <refpurpose>run a command in a NixOS chroot environment</refpurpose>
16 <command>nixos-enter</command>
19 <option>--root</option>
21 <replaceable>root</replaceable>
26 <option>--system</option>
28 <replaceable>system</replaceable>
35 <replaceable>shell-command</replaceable>
40 <option>--silent</option>
46 <option>--help</option>
54 <replaceable>arguments</replaceable>
59 <title>Description</title>
61 This command runs a command in a NixOS chroot environment, that is, in a
62 filesystem hierarchy previously prepared using
63 <command>nixos-install</command>.
67 <title>Options</title>
69 This command accepts the following options:
74 <option>--root</option>
78 The path to the NixOS system you want to enter. It defaults to
79 <filename>/mnt</filename>.
85 <option>--system</option>
89 The NixOS system configuration to use. It defaults to
90 <filename>/nix/var/nix/profiles/system</filename>. You can enter a
91 previous NixOS configuration by specifying a path such as
92 <filename>/nix/var/nix/profiles/system-106-link</filename>.
98 <option>--command</option>
105 The bash command to execute.
111 <option>--silent</option>
115 Suppresses all output from the activation script of the target system.
125 Interpret the remaining arguments as the program name and arguments to be
126 invoked. The program is not executed in a shell.
133 <title>Examples</title>
135 Start an interactive shell in the NixOS installation in
136 <filename>/mnt</filename>:
139 <prompt># </prompt>nixos-enter --root /mnt
145 <prompt># </prompt>nixos-enter -c 'ls -l /; cat /proc/mounts'
148 Run a non-shell command:
151 # nixos-enter -- cat /proc/mounts