nixos-install8NixOSnixos-installinstall bootloader and NixOSnixos-installpathrootDescriptionThis command installs NixOS in the file system mounted on
/mnt, based on the NixOS configuration specified
in /mnt/etc/nixos/configuration.nix. It performs
the following steps:
It copies Nix and its dependencies to
/mnt/nix/store.It runs Nix in /mnt to build
the NixOS configuration specified in
/mnt/etc/nixos/configuration.nix.It installs the GRUB boot loader on the device
specified in the option ,
and generates a GRUB configuration file that boots into the NixOS
configuration just installed.It prompts you for a password for the root
account.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.OptionsThis command accepts the following options:Defaults to /mnt. If this option is given, treat the directory
root as the root of the NixOS installation.
Add a path to the Nix expression search path. This option may be given multiple times.
See the NIX_PATH environment variable for information on the semantics of the Nix search path.
Paths added through -I take precedence over NIX_PATH.Causes Nix to print out a stack trace in case of Nix expression evaluation errors.Chroot into given installation. Any additional arguments passed are going to be executed inside the chroot.
Synonym for man nixos-install.ExamplesA typical NixOS installation is done by creating and mounting a
file system on /mnt, generating a NixOS
configuration in
/mnt/etc/nixos/configuration.nix, and running
nixos-install. For instance, if we want to install
NixOS on an ext4 file system created in
/dev/sda1:
$ mkfs.ext4 /dev/sda1
$ mount /dev/sda1 /mnt
$ nixos-generate-config --root /mnt
$ # edit /mnt/etc/nixos/configuration.nix
$ nixos-install
$ reboot