NixOS 101 Course / Section 1: Getting started: install NixOS and live with it
Premium

1.3 Build your own custom NixOS installer ISO

Lesson 3 of 28 · 6:00

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

Video chapters

  1. 0:00 Why build a custom NixOS installer
  2. 0:52 Creating the flake and ISO image
  3. 2:12 Adding packages and enabling flakes
  4. 3:18 Building the installer ISO
  5. 4:06 Repository demo with Wi‑Fi, Vim, and SSH
  6. 5:24 Running the VM preview
Transcript

Why build a custom NixOS installer

0:00 So, before we learn how to install NixOS on a real machine or on a VM, let's build our own quick custom installer. This is particularly easy with NixOS and a particular nice thing about custom installers is that in contrast to just downloading the standard one, you can create your own USB stick that you can then just boot from and that has your Wi-Fi already activated and that has your SSH keys and other tools, favorite text editor and stuff like that.

0:30 And if you do many installations at home or at work or whatever, having your own custom installer that you just built once and then reuse all the time is really useful. So let's jump right into it. Have an empty folder here and we can initialize a new flake. And in that flake, we can say, okay, that's my custom installer.

Creating the flake and ISO image

0:59 And then let's remove the standard packages here and then we can say packages.nixos. And later we will put in our own configuration that we create right after this. Then we can say config.system.build.isoImage. So this part, this NixOS function that we don't know yet. How do configurations look like and what is this magic path here? That is, we're going to learn about that in the training later.

The full transcript comes with the lesson.

About this lesson

The stock NixOS installer works, but every installation starts with typing your Wifi password and fetching your tools again. In this lesson you build your own installer ISO from a small flake, with your editor, your Wi-Fi, and your SSH key already inside. Boot it on a spare laptop and install from your desk over SSH.

In this video

  • A flake that turns the official minimal installer into your own with a handful of lines
  • Adding packages, enabling flakes, and choosing which platform the image is for
  • Wifi credentials baked into the image (and the security trade-off)
  • A preloaded SSH key that makes the installer reachable right after boot
  • Trying your installer in a local VM before you write a single USB stick

After this lesson

You have a reusable installer that fits your habits, and a VM that is ready for the installation in the next lesson.

Links: