nixos-install8NixOSnixos-installinstall NixOSnixos-installDescriptionThis 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.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.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