nixos-enter man page

 

nixos-enter __ — run a command in a NixOS chroot environment

Synopsis

nixos-enter [--root root] [--system system] [-c shell-command] [--help] [-- arguments]

Description

This command runs a command in a NixOS chroot environment, that is, in a filesystem hierarchy previously prepared using nixos-install.

Options

This command accepts the following options:

--root

The path to the NixOS system you want to enter. It defaults to /mnt.

--system

The NixOS system configuration to use. It defaults to /nix/var/nix/profiles/system. You can enter a previous NixOS configuration by specifying a path such as /nix/var/nix/profiles/system-106-link.

--command, -c

The bash command to execute.

--

Interpret the remaining arguments as the program name and arguments to be invoked. The program is not executed in a shell.

Examples

Start an interactive shell in the NixOS installation in /mnt:

# nixos-enter /mnt

Run a shell command:

# nixos-enter -c 'ls -l /; cat /proc/mounts'

Run a non-shell command:

# nixos-enter -- cat /proc/mounts

Author

Eelco Dolstra

Author

Info

01/01/1970 NixOS Reference Pages