Installation

All of the commands in this section should be run as root with sudo.

Partitioning, Formatting, and Mounting

  1. Partition your disk(s) like you would any other system. The usual collection of partitioning tools are provided. (I recommend cfdisk.)

  2. Format your partitions using the various mkfs commands. LVM volumes and mdadm software RAID are also supported.

  3. Mount your partitions in /mnt the same way you want the system to mount them in /. Enable any swap devices you've created with swapon.

UEFI systems should use a GPT disk containing a >=512MiB EFI System partition. It should be formatted FAT32 (mkfs.fat -F 32) and mounted as /boot.

Installing

Before installing, you need a file /mnt/etc/nixos/configuration.nix which describes your system configuration. In later sections we will discuss this configuration, but for now you can generate a reasonable default like so:

nixos-generate-config --root /mnt

You can have a look at the resulting configuration if you'd like a sneak peek. (nano is provided for text editing.) For now, the defaults should be fine.

Once you're ready to install:

nixos-install

After the install finishes, you'll be asked for a password you can use to login as root after rebooting.

see also NixOS Manual: Part 1. Installation