Rebuilding My Homelab with NixOS — Part 1: The Overview
AI Disclosure:
AI was used to help troubleshoot and fix my Nix configuration files, as well as correct the grammar in this post.
Intro
Hello! This is my first post here!
I work as a sysadmin, and I hope you all have a nice day!
Before we get started, a quick note: I’ve already finished rebuilding my homelab. I’m writing this post to share how it went, what worked, and what didn’t.
My homelab previously ran mostly on Debian-based systems. In this post, I want to take you along for the ride and explain why I decided to rebuild my homelab using NixOS, as you might have guessed from the title.
Now, why NixOS? Well, at work, we’re looking to move more towards GitOps, and I wanted to see if NixOS could scratch that itch. I also wanted to learn a completely new way of managing packages and system configurations.
I’m planning to make this a series of posts. This first post will focus on an overview of my homelab, including the hardware, network, and services I was running before the rebuild.
In future posts, I’ll go through each host, explain how I installed and configured NixOS, and share the problems I ran into along the way.
The Plan
First, I needed a plan before I started breaking things!
- Inventory: Make a list of all the services I was running and where they were hosted.
- Hardware: Figure out which machines would run NixOS and what their roles would be.
- Configuration: Set up a Git repository to manage my NixOS configurations.
- Secrets: Figure out how to manage secrets without putting passwords or API keys in Git.
- Backups: Make sure my important data was backed up.
Did I follow this plan perfectly? Of course not. xD
Hardware in My Homelab
My homelab consists of four Raspberry Pis, a QNAP NAS, and an old PC. I also have a reverse proxy running as a VM on Proxmox.
Physical Hardware
| Hostname | Hardware | CPU | RAM |
|---|---|---|---|
| pi01 | Raspberry Pi 4 Model B | Broadcom BCM2711 | 2 GB |
| pi02 | Raspberry Pi 5 | Broadcom BCM2712 | 8 GB |
| pi03 | Raspberry Pi 5 | Broadcom BCM2712 | 8 GB |
| pi04 | Raspberry Pi 5 | Broadcom BCM2712 | 8 GB |
| nas02 | QNAP TS-251A | Intel Celeron N3060 (2C/2T) | 2 GB |
| nas01 | Old PC | Intel Xeon E5-2620 v4 (8C/16T) | 64 GB |
Nothing too fancy, but more than enough hardware to have some fun with NixOS!
Reverse Proxy VM
My reverse proxy is hosted on a Proxmox node outside my Raspberry Pi setup.
| Component | Details |
|---|---|
| Hostname | proxy-anne-prive |
| Proxmox node | huygens02 |
| CPU | 4 vCPUs |
| RAM | 8 GiB |
| Boot disk | 64 GiB |
| Networking | Public IPv4 and IPv6 |
I’ll explain what this VM does a little further down.
Network Setup
Before getting into the NixOS configuration, here’s a quick overview of how my homelab was connected before the rebuild.
For my local network, I use UniFi networking equipment, consisting of a router, three switches, and an access point.
Local Network
| Device | Hostname | Connection |
|---|---|---|
| Router | router01 | 1 GbE |
| Switch | swh01 | 2.5 GbE |
| Switch | swh02 | 1 GbE |
| Switch | swhome01 | 1 GbE |
| Access Point | ap01 | 1 GbE |
VLANs
I also use VLANs to separate different types of devices on my network and keep things a bit more organized.
| VLAN Name | VLAN ID | Purpose |
|---|---|---|
| network-gear | 1 | Network infrastructure |
| servers | 10 | Servers and homelab services |
| wifi | 11 | Wi-Fi devices |
| cameras | 12 | Security cameras |
| clients | 13 | Client devices |
Nothing too complicated, just some basic network segmentation to keep things tidy.
WireGuard and Reverse Proxy
Before the rebuild, all four Raspberry Pis were connected to my reverse proxy through WireGuard tunnels.
The reverse proxy runs as a VM on Proxmox and has both a public IPv4 and IPv6 address. I use UFW (Uncomplicated Firewall) to manage the firewall rules.
This setup allowed me to expose my self-hosted services through the reverse proxy without directly exposing the Raspberry Pis to the internet.
Nginx handled incoming requests and forwarded them to the appropriate services over the WireGuard tunnels.
During the rebuild, I also moved from my old WireGuard setup to Headscale, but I’ll cover that in another post!
Services Running in My Homelab Before NixOS
Now that we’ve covered the hardware and network, let’s take a look at what I was running before switching to NixOS.
And yes, there were quite a few services. xD
pi01 — Raspberry Pi 4 (2 GB RAM)
Before the rebuild, pi01 was running Debian-based Linux with the following services:
| Service | Purpose |
|---|---|
PostgreSQL (psql) |
Relational database |
| Valkey | In-memory data store |
| SearXNG | Privacy-focused metasearch engine |
| MQTT | Message broker |
Not bad for a little Raspberry Pi 4 with only 2 GB of RAM! xD
pi02 — Raspberry Pi 5 (8 GB RAM)
Before the rebuild, pi02 was running quite a few self-hosted services.
| Service | Purpose |
|---|---|
| Signal K | Marine data server |
| n8n | Workflow automation |
| Mastodon | Self-hosted social network |
| Nextcloud | File synchronization and cloud storage |
| Garage | S3-compatible object storage |
| ArchiveBox | Web archiving |
| Joplin Server | Note synchronization |
| Redlib | Privacy-friendly Reddit frontend |
| Iocaine | AI tarpit |
| FreshRSS | RSS feed reader |
Quite a lot for a little Raspberry Pi 5!
pi03 — Raspberry Pi 5 (8 GB RAM)
Before the rebuild, pi03 was running a mix of messaging, home automation, and other self-hosted services.
| Service | Purpose |
|---|---|
| Matter Server | Matter smart home device integration |
| WhatsApp integration | |
| ntfy | Push notification service |
| Data | Data storage |
| Home Assistant | Home automation platform |
| Synapse | Matrix homeserver |
| Iocaine | AI tarpit |
| Vaultwarden | Self-hosted password manager |
| Logs | Logging service |
| ESPHome | ESP device management |
| Matter | Matter-related service |
| TadoLocal | Local Tado integration |
| Signal | Signal integration |
| Discord | Discord integration |
| signal-cli | Signal command-line integration |
Apparently, I decided that 8 GB of RAM was enough to run half the internet. xD
pi04 — Raspberry Pi 5 (8 GB RAM)
Before the rebuild, pi04 was running a mix of automation, archiving, and other self-hosted services.
| Service | Purpose |
|---|---|
| n8n | Workflow automation |
| Mastodon | Self-hosted social network |
| ArchiveBox | Web archiving |
| Iocaine | AI tarpit |
| Signal K | Marine data server |
And yes, some services appear on multiple hosts.
A Quick Note About Iocaine
You might have noticed Iocaine appearing on multiple machines.
Iocaine is an AI tarpit designed to protect servers from unwanted AI crawlers. Instead of serving useful content, it can lead crawlers through generated pages, wasting their time and resources.
And yes, the name is a reference to The Princess Bride. xD
Reverse Proxy — Proxmox VM
Besides the Raspberry Pis, I also had several services running on my reverse proxy VM.
This machine acts as the public entry point for my self-hosted services.
| Service | Purpose |
|---|---|
| Nginx | Reverse proxy for self-hosted services |
| Stalwart | Mail server |
WireGuard Easy (wg-easy) |
WireGuard VPN management |
| Element Call | Self-hosted Matrix calling |
| ACME | TLS certificate management |
| UFW | Firewall management |
Nginx handled incoming HTTP and HTTPS traffic and forwarded requests to the appropriate services through WireGuard.
I also used Stalwart for email, Element Call for Matrix calls, and UFW to control which ports were accessible from the internet.
This setup worked pretty well, but I eventually decided to change how I managed the VPN connections.
More about that in a future post!
What About the NAS Servers?
You might have noticed that I haven’t covered nas01 and nas02 in the service overview.
They’re also part of my homelab, but I want to keep this first post focused on the Raspberry Pis, networking, and the services involved in the rebuild.
I’ll cover the NAS setup in more detail in a future post.
Why Rebuild Everything?
At this point, you might be wondering why I wanted to rebuild everything if it was already working.
Well, there were a few reasons.
The biggest one was that I wanted to learn NixOS and get more experience with declarative system configuration.
With my old Debian-based setup, I had configurations spread across different machines. I wanted to experiment with managing more of my infrastructure through configuration files stored in Git.
Since we’re also looking at GitOps more seriously at work, this seemed like a good opportunity to experiment with those ideas at home.
And, of course, sometimes you just want to rebuild something because you can. xD
What’s Next?
Now that you’ve seen the hardware, network, and services I started with, it’s time to get into the actual NixOS rebuild.
In the next posts, I’ll cover how I installed and configured NixOS on my Raspberry Pis, how I organized my configuration files, and what I learned along the way.
I’ll also go into more detail about managing secrets, moving from WireGuard to Headscale, and figuring out how to manage everything through Git.
There were definitely some things that didn’t go according to plan, but that’s part of the fun of running a homelab!
One post at a time, otherwise this would turn into a book. xD
Thanks for reading my first post!
If you have any questions, suggestions, or tips about NixOS, feel free to share them. I’m still learning, and I’m always happy to discover better ways of doing things.