theme: ricetheme
New palette
New palette

Install NixOS Step by Step, From ISO to First Boot

Install NixOS from ISO to first boot with graphical or manual steps, disk setup, a working configuration.nix, and desktop editor and theme setup.

A dark-themed illustration shows four steps for installing NixOS: USB creation, partitioning, installation progress, and first boot.

tl;dr the short answer

NixOS is a Linux operating system installed from a bootable image and managed through a configuration file that describes the system you want. Installing it means preparing and partitioning a disk, matching the bootloader to your firmware, then building the system from that configuration; later changes are applied with rebuilds. Numbered system generations let you return to an earlier working setup, making experimentation and recovery easier.

Think about moving into a new apartment. You can unpack box by box and hope everything finds a home, or you can sketch the floor plan first. NixOS rewards the floor plan.

Your whole system is described in one file, configuration.nix, and the installer builds everything from it.

This guide takes you from downloading the ISO (a bootable disk image) to your first boot. You’ll choose a graphical or manual route, split your disk, write a working config, and learn how rollback undoes a bad update.

We’ll also set up an editor and a theme, the desktop touches most guides skip.

Prepare Media to Install NixOS

Before you partition anything, you need an installer on a stick, a few firmware settings sorted, and a working connection.

Pick the right ISO and download it

An ISO (a disk image holding a complete bootable system) is your installer. The minimal ISO boots to a plain terminal, while the graphical ISO boots to a desktop.

Grab either from nixos.org and verify its checksum (a fingerprint proving the file arrived intact) against the published value with sha256sum. Because the image is hybrid, it works on a USB (Universal Serial Bus) stick or a CD (Compact Disc).

You can also build a custom ISO, but the stock image is easier for a first install.

Write the image to a USB drive

Here are your options:

  • Linux: dd or cp writes the image.
  • macOS: use diskutil to find and unmount your stick, then write with dd.
  • Graphical tools: balenaEtcher (a point-and-click writing tool) and USBwriter both work if you’d rather click than type.

Target the whole disk (/dev/sdX), not a partition (/dev/sdX1). Multiboot tools that stack several ISOs on one stick aren’t supported, so give NixOS its own stick. Double-check the device name first. Wrong target, wiped disk.

Set firmware settings to boot the installer

Your firmware boots in one of two modes: BIOS (Basic Input/Output System, the legacy method) or UEFI (Unified Extensible Firmware Interface, the newer standard). Disable Secure Boot, since the installer needs it off.

Then move the USB stick to the top of the boot order, or use the one-time boot menu.

Once booted, check whether /sys/firmware/efi/efivars exists. If it does, you’re in UEFI mode; if not, you’re in BIOS. The actual mode matters more than the menu label.

Connect to the internet before installing

The installer needs internet, so sort this first. Wired connections are usually automatic, since DHCP (Dynamic Host Configuration Protocol, the service that hands your machine a network address) should just work.

Wi-Fi setup depends on which ISO you chose:

  • Graphical ISO: use nmtui, a text-based network manager.
  • Minimal ISO: use wpa_supplicant, the tool that handles Wi-Fi authentication.

Consider a student with an old laptop and no Ethernet port. When Wi-Fi fails, phone tethering (sharing your phone’s data connection) is your fallback, and the install keeps moving.

Split, Format and Mount Your Disk

Before NixOS can land anywhere, you’ll need to carve up the disk it will live on. One wrong pick here can cost you data, so double-check each move.

Find your disk and create partitions

Start by running lsblk to list your drives and their sizes, then match the size to the disk you expect.

Next, pick a partition table, the map that tells the firmware where each partition starts. Modern machines use a GPT (GUID Partition Table) with an EFI (Extensible Firmware Interface) partition.

Older ones pair an MBR (Master Boot Record) layout with BIOS (Basic Input/Output System). The choice follows your hardware, not your preference.

Create partitions with parted or fdisk, and give the EFI partition about 500MB.

Think of a student with a ten-year-old ThinkPad making room for NixOS. They confirm the drive by size, so their other files stay untouched. Check twice, partition once.

A student uses a laptop displaying terminal drive info and partition bars, with a sticky note advising to check twice.

Pick filesystems for boot and root

Both partitions need a filesystem, the format that organizes their files:

  • Boot: FAT32 (File Allocation Table 32), which the firmware can read.
  • Root: ext4 (fourth extended filesystem), labeled nixos so you can mount it by name.

ext4 is the dependable pick, not the flashiest one. btrfs (B-tree filesystem), XFS (built for large files), and ZFS (volume management built in) are alternatives, and bcachefs and LVM (Logical Volume Manager) are worth a look later.

Mount everything under /mnt first

Mounting attaches a partition to a folder the installer can see. Do this before running nixos-generate-config, and don’t skip a step:

  1. Mount the root by label: mount /dev/disk/by-label/nixos /mnt
  2. Create the boot folder: mkdir -p /mnt/boot
  3. Mount your EFI partition at /mnt/boot.

Mount root before boot, never after, because /mnt/boot lives inside the root filesystem.

Configure a swap file and its size

A swap file is disk space your system uses when your memory runs low. Think of a developer with too many tabs open and a compiler running: the swap file catches the overflow.

Declare it in configuration.nix and NixOS sets it up. A 16GB example looks like this (sizes are in megabytes):

swapDevices = [ { device = "/swapfile"; size = 16384; } ];

Size it once and move on.

Write Your Configuration.nix File

This is where your install stops being stock and starts being yours.

Generate your first config automatically

Run nixos-generate-config --root /mnt to write two files into /mnt/etc/nixos/: configuration.nix, the file you’ll edit, and hardware-configuration.nix, which is auto-detected from your disks and hardware.

Whether you took the graphical Calamares route or the manual one, you edit this same file. Encrypting your root with LUKS (a common way to encrypt a disk on Linux)? The generated hardware file already reflects that layout, so leave it be.

NixOS is declarative: you describe what you want your system to be, not the commands that get it there. Edit the file, rebuild, and the machine matches it. Picture a student with a ten-year-old ThinkPad who wants the same setup as their desktop.

They copy one config over, rebuild, and the laptop ends up matching.

Core settings like hostname and users

Most of your daily setup lives in a short list of settings:

  • Hostname and networking: the name your machine goes by and how it connects.
  • Timezone, locale, and keyboard layout: so clocks, dates, and keys behave the way you expect.
  • User account: the login you’ll use every day.
  • System packages and editor: the tools available on every boot.
  • SSH, sound, and desktop environment: remote login, audio, and your chosen desktop.
  • Fonts and desktop theme: the look that makes it feel like yours.

Declare your editor too. Listing Neovim or Helix in the config beats installing it by hand, because it becomes part of the system itself.

A Linux user who wipes a laptop to fix a broken setup keeps their editor, fonts, and theme in the file, so one rebuild brings the familiar look back. That’s an afternoon saved.

Dark-themed laptop screen assembling a restored desktop with code and color swatches, linked by a cyan arrow from a floating config card.

Pick the bootloader that matches your firmware

Your firmware decides which bootloader you need, not your taste. UEFI (the modern firmware standard) uses systemd-boot, while older BIOS firmware uses GRUB. A wrong bootloader causes failure, so a GRUB setup copied onto a new UEFI laptop won’t start.

Secure Boot is optional, so you can skip it and still get a working system.

Choose a release channel and stateVersion

Stable is the safer pick for daily driving, while unstable brings newer packages sooner, with more change along the way. Set stateVersion once, at install, to the release your system started on, and don’t bump it on upgrades.

A ricer who upgrades every few months keeps the same number while the packages move forward. Leave it alone.

Search for options and packages

Stuck on an option name? The NixOS options search site shows what it’s called and what it does. For packages, nix search finds the exact name of something you spotted in a screenshot.

Say a tinkerer copies that name into the file and rebuilds: the font becomes part of the setup, not a one-off download. To edit, open the file in nano, or use nix-shell to borrow an editor for one session.

Run the Install and Reboot into NixOS

Your install is nearly done, and a single reboot stands between you and your own system. Here’s how to finish up, confirm it’s healthy, and keep a way back if a change goes wrong.

Run nixos-install and set a root password

Run nixos-install from /mnt, where your new system is mounted. The download size varies, so give it time. Set a root password when prompted, then reboot and pull out the USB stick so the machine boots from disk.

Check that the new system works

Log in and run passwd to swap in a password you’ll remember. Then run systemctl --failed: an empty list means nothing failed to start, and anything listed is worth a look. Run nixos-version to confirm which release you’re on.

Apply changes and roll back with nixos-rebuild

Every change to configuration.nix, the file describing your whole system, goes through nixos-rebuild in one of three modes:

  • switch builds and activates the config, and makes it the default boot entry.
  • test activates it for this session only and leaves the boot menu alone.
  • build only builds it, so you can check for errors without changing anything running.

Reach for test while experimenting and switch once you want to keep the change.

Each switch creates a generation, a numbered snapshot of your system that shows up in the boot menu. Picture a student on a ten-year-old ThinkPad who tweaks their status bar and gets a broken panel.

They reboot, pick the previous generation, and they’re back at their desk in minutes. That’s your safety net.

From a running system, sudo nixos-rebuild switch --rollback steps back one generation. Offline? Add --offline so it skips downloads and uses what’s already local.

Fixing Common Problems and Unusual Setups

Most install failures have familiar causes. Here’s how to fix them, plus the quirks of unusual setups.

Fixes for the most common install errors

  • Out of disk space. Check your partition sizes before you retry.
  • No network after boot. Check the networking section of configuration.nix, then rebuild.
  • Wrong bootloader type. The bootloader starts your system, so it must match how your machine boots: UEFI (Unified Extensible Firmware Interface) or legacy BIOS (Basic Input/Output System).
  • Package not found. Check the package name and your channel (the package set).
  • GRUB partition confusion. GRUB (GRand Unified Bootloader) shows your boot menu. If it points to the wrong partition, confirm which disk holds your boot files.

Flat illustration showing five NixOS installation troubleshooting steps with coral error icons and green fix solutions inside a dark terminal.

When your hardware gets in the way

Dell laptops can need model-specific tweaks, so check notes for your exact model.

On servers, the initrd (the initial ramdisk, a small early-boot system) needs the right kernel modules (drivers) to reach your disks. If it can’t, add them to the initrd settings in configuration.nix.

Picture a homelabber turning an old HP ProLiant into a file server. If the disks vanish after reboot, check the hpsa module, the driver for HP Smart Array controllers. Loading it brings them back.

Other platforms like Raspberry Pi and cloud

  • ARM and Raspberry Pi. ARM (a processor design family) boards like the Raspberry Pi need their own image, not the standard desktop installer.
  • Cloud and remote servers. A remote server has no screen, so plan how you’ll reach it first.
  • Install from existing Linux. Consider a student with a ten-year-old ThinkPad running Ubuntu who wants NixOS on that same machine, with no separate installer to boot. Same machine, new system.
  • Nix on other systems. The Nix package manager also runs on other operating systems, so you can try it before committing.

Learn More and Tackle Advanced Topics

Once NixOS boots, the work shifts from installing to understanding. Here’s where we’d point you next.

Where to find manuals and tutorials

Start with the official NixOS manual, the reference to check when a step doesn’t match your screen. Community tutorials and blogs fill the gaps with real-world walkthroughs, but check their dates, since NixOS changes between releases.

If the official instructions seem confusing, that’s normal. Search the exact wording of the step alongside a community post and compare the two.

Think of a student with a ten-year-old ThinkPad who got stuck on a partitioning screen. A blog post with the same screens got them unstuck in ten minutes.

Learn flakes later and try Home Manager

Flakes are a newer way to organize your Nix configuration, and they’re still marked experimental. You don’t need them on day one, so learn them once the basics feel comfortable.

The goal is growing your setup over time, not rebuilding it every time you tweak something.

Home Manager manages packages and settings for your own user account. It’s a declarative alternative (you describe what you want in a config file) to nix-env, the older command for installing packages one at a time.

It also handles dotfiles and themes, so a tinkerer can keep the colors for their terminal, bar, and editor in one place.

Keep your configs in git so every change is recorded and easy to undo. Commit often.

Keep your disk from filling up

Every rebuild adds packages to the Nix store, the folder where NixOS keeps them, and old system versions stick around so you can roll back. Give the root partition plenty of room during partitioning to keep that growth manageable.

To reclaim space, run nix-collect-garbage, which removes store paths that nothing references anymore. Deleting old generations removes your rollback points, so only clear those out once you’re sure you won’t need them.

Picture a ricer whose laptop disk fills up after months of trying new packages. One cleanup run frees the space, and they’re back in business.

You’ve got the whole path now: a bootable USB, a partitioned disk, a configuration you wrote yourself, and a rollback safety net if something goes wrong. Each step builds on the last, so the plan holds even when the details shift.

From here, every tweak is one edit and one rebuild away, and a bad one is one rollback away. It’s a system you built from one file, with a safety net under every change.