1.4 Installing NixOS by hand: partition, format, mount, install
Lesson 4 of 28 · 21:01
Video chapters
-
0:00 Choosing the NixOS installer
-
2:25 Installation workflow overview
-
5:36 Disk partitioning and formatting
-
10:07 Generating config and editing NixOS settings
-
16:58 Running nixos-install and rebooting
Transcript
Choosing the NixOS installer
0:00 All right let's start installing NixOS on either a real computer or a VM. If you do the same thing as we do in the video now then you're gonna download the NixOS installer and that is we have like two options now and the video before this one we've seen how to create our own custom installer. I have checked that out in this repository and the readme already shows after we have built the ISO image we can dd it onto USB stick with this command here at the bottom so that's one option. The other option is going to the nixos.org homepage clicking on the download button scrolling past Nix to NixOS and here we can either download the graphical ISO image or the minimal ISO image. I do always prefer the minimal ISO image because I don't need the assistance to have me click through it and for learning how NixOS really works I also don't recommend it because the minimal ISO image and/or our custom installer which basically is based on the minimal ISO image forces us to do the partitioning formatting and stuff so on ourselves and this way it's clear like how you would automate this because the graphical installer is practically already automated so far right. And then what's interesting is that from the minimal ISO image section we can go to the manual. Of course you could also just surf to nixos.org/nixos/manual
1:36 which I recommend to have on a bookmark and there it explains how to install NixOS so typically we go to boot from the install medium where they also explain how to flash the stick and stuff like that and manual installation continues with networking and so on. Let's park that on the side and run a NixOS or a VM that basically runs this particular installer but this one is the custom one it's not really different from the stock one right we just have a better text editor installed and so on so not really missing out if you skipped the custom installer step and then we can see that the VM boots. Okay now we're we're there so we can park the VM image here typically you would go sudo su to
Installation workflow overview
2:28 become root and now what do we even do? The typical installer dance with NixOS works like this we have to of course boot the live system somehow so with a real laptop that's a USB stick or on a server you could boot over network or whatever there's multiple methods right then you somehow need to get network because the NixOS installation is particularly network hungry we're downloading so many packages right then we have to partition format and mount the disks which we're gonna do exactly as the documentation says in this example then we need to generate a configuration which is done with the nixos-generate-config command that scans our system what's there and creates a NixOS configuration that we can start with as we will see this part is if you automate installations then you can basically just download a configuration that you already created before and then we install the installation will use those partitions that we kind of created and mounted and the configuration and install NixOS into that and then we can reboot and throw away the live installer so let's have a look how that works back here questions now what is the magical sequence of commands to install and we can basically scroll further where the documentation also explains about partitioning formatting and so on what's important here is that the installation has two different sections so there's like UEFI GPT that's the partitioning layout of modern computers when you
The full transcript comes with the lesson.
About this lesson
Graphical installers hide the steps you later want to automate.
This lesson installs NixOS in a VM the manual way, following the official NixOS manual:
Partitioning, formatting, mounting, generating a configuration, and running nixos-install.
Do it once by hand, and tools like disko and nixos-anywhere stop being magic.
In this video
- The NixOS install dance in five steps, and which of them you will automate later
- UEFI or legacy boot: the quick check that tells you which instructions to follow
- Partition labels and why they make device names like
/dev/sdairrelevant afterwards - What
nixos-generate-configdetects about your machine system.stateVersion: The line everyone is tempted to bump when upgrading and why you should please never touch it
After this lesson
You have a freshly installed NixOS system. You understand the installation phases for later automation.
Links:
- NixOS iso download: https://nixos.org/download/#nixos-iso
- NixOS installation manual: https://nixos.org/manual/nixos/stable/index.html#sec-installation