Rebuilding My Homelab In NixOS (Part 1) Creating the NixOS VM

Feb 26, 2025    #nixos   #homelab  

The Catalyst:

I have stepped away from doing writeups for a little while, purely due to wanting to mix things up and the fact that I was just grinding for a year prior to get my CPTS certification; I actually have a number of writeups for active boxes written just not on the site due to the terms and conditions by HTB. And as I needed something else to spend my time with I created a Proxmox cluster using two nodes (I know I know you need 3 nodes for it actually be a cluster) & also set up a Proxmox backup server. However that took all of an hour to do, honestly, it was one of the easiest setups I have ever done (I will create a writeup for this soon enough.)

As the Proxmox cluster setup was painless I needed another project. I decided to migrate my containers from Truenas Scale to a Virtual Machine in the Proxmox cluster, with a separate drive being mounted to the VM to host all the docker data. The reason being is that although I like Truenas Scale & their apps I don’t like the fact that I have to configure things with a GUI. I want to be able to create a docker compose.yml file with all the services I want to run and simply run docker compose up -d. This approach means that I can also commit the compose.yml to git for version control and if I ever need to rebuild, I can just spin up another VM, git-clone the repo & re-mount the data drive. This also means I can have the data drive backed up with the Proxmox backup server. Another primary driver for this approach has been due to me working more with Ansible & Docker at my workplace as means to create reproducible builds.

So I did this, created the Ubuntu VM & additional drive in Proxmox, installed docker & docker compose, wrote the compose.yml, transferred the existing docker data from Truenas scale, and everything was working perfectly. I had my media server, reverse proxy etc and things were ticking over nicely for all of an hour…until I heard the voice “NixOS…..join us for truly reproducible builds and version controlled configuration files” thus began my journey with NixOS. Because why use continue to use a perfectly working system when I can switch to a new distro/OS (where it turns out even though I have been working with arch as my daily driver for years I will have a STEEP learning cure) and struggle to get things running.

Why NixOS:

Reason 1: Single Source of Truth:

Reason 2: Immutable Builds:

Reason 3: Easily Roll-back to Previous Configuration:

Additional Benefits:

Flakes:

Creating the NixOS VM:

Download the NixOS ISO:

Upload the NixOS ISO:

Creating a VM on Proxmox:

Creating an additional drive to host our docker data:

Installing NixOS:

Start the VM:

Follow the installer prompts:

Login to NixOS:



Next: Rebuilding My Homelab In NixOS (Part 2) Enabling SSH Login in NixOS