Skip to content

Homelab

Alec edited this page May 27, 2026 · 4 revisions

As part of my past Flavortown submission, I have integrated my homelab flake into this monorepo of sorts. Discussion of how to set up your own homelab following this flake is available in the Installation and the Implicit Setup pages. This page will go into detail more about what this host does.

It's a homelab

A homelab is a way for you to self-host services and things that you'd otherwise need other hosted services for. A homelab allows you to get away from the clutches of corporate greed (wherein this host specifically targets migration from Spotify, Microsoft (Github), and Google) by allowing you to have real control over your own data.

It's also a Pi Zero 2W

This is a very underpowered device. I've chosen it since I have a few laying around, and I thought it'd be fun to reuse a Daydream prize (which included this kit) towards another Hack Club program (and yes, I do plan on using my Orpheus Picos/Picoducky from Flavortown (which I got from submitting this Homelab project) towards Stardance, I shall continue the trend)

The outer case (which requires the acrylic plates) is available here

Seeing as the device has just half a gig of RAM, it doesn't make sense to run intensive programs or services. This device can't even build itself - you have to use remote deployments to update it. I have intentionally chosen lightweight services and programs for this server to run, and I have offloaded heavier tasks such as development and running Minecraft servers to my more powerful Pi 4B (bundled in this flake under the alecdev host).

The alecdev host in a custom permapi case, running more resource-intensive services

USB architecture

The Pi Zero 2W has an SD card slot. It's convenient for writing an SD image to, but not so great for long-term storage given its limited read/write lifespan. As the Pi Zero 2W has an additional USB port, I've chosen to go for USB storage on this device. The SD card should ONLY be used for storing secrets and maybe a few logs here and there. Everything else must be stored on a storage medium which should be less prone to failure. (seriously - SD cards are really not durable)

image

Display

I had an old 1.44in Waveshare HAT I originally bought for my Pi 4B (for my previous homelab, running Debian) that I've now repurposed for this Pi. The HAT is the same across all Pi devices so it was just a matter of getting SPI output and GPIO working (which was probably one of the most painful parts - especially given that nixpkgs just dropped prepackaged Pi Zero-flavored kernels and I'm hesitant to pull in nix-hardware for such a small thing - eventually got it working with a simple dtoverlay).

I wrote a custom display program to show logs/server stats, toggle display state, and control power. It is quite basic yet fully functional. If you are interested in this part of the server the most, you can read its C source code here as it is stored out of tree from this flake: https://github.com/amazinaxel/homelab

Pass store

Probably the most crucial to my daily workflow is the zx2c4 pass store. This stores all of my GPG-encrypted passwords that I sync between all of my devices, even ones outside my Linux/flake ecosystem. My devices pull from this a random intervals throughout the day when they sync with the homelab.

The homelab is simply hosting a Git repository that's accessed over SSH. It's that simple, and insanely lightweight. I rely on PassFF for Zen integration with my passwords and it works great. This way, I don't have to rely on my browser storing my password insecurely or exposing my passwords to a hosted password manager.

Syncing

The homelab regularly pulls all Github repositories (even private ones) to the USB drive. In case I don't have access to my repositories online due to a Github outage or service, I always have up-to-date working backups. Additionally, my Spotify playlists are downloaded to the USB drive (which does take up a lot of storage). However, this saves bandwidth in the end because these playlists power my mpd player built into the shell. When my devices sync the music, it's pulled locally from the homelab, and given that I have several devices which need this music, it effectively reduces bandwidth by 3x while still allowing for offline usage.

Air quality monitoring

If you've seen the image above with my ESP32 devboard and my Nova SDS011 PM sensor, now you know why. The homelab acts as a webserver to both accept, store, and display readings from the government and from my sensor.

Here in Washington state, we're very prone to wildfires. Our smoke seasons have become predictably bad, resulting in poor air quality throughout the late summer/early fall months. My goal is to understand and document these changes in outdoor air health so we can stay safe during hazard periods.

First, the ESP32 is flashed with a custom firmware which accepts readings from the SDS011. It sends these readings periodically to the homelab through a simple HTTP POST request. The homelab accepts this data and timestamps the data in a sqlite database on the USB drive. When a user visits the webserver, it reads from both the sqlite database (either from the past day or few weeks) and from AirNow.gov through an API key stored on the homelab. You can use this data to know when its safe to go outside and can confirm if your readings are accurate.

Other services

I have a lofi player that my little brother uses, which is served by a php development webserver. I have a Samba share set up so you can use the attached USB drive as a simple NAS. It has autoconfiguration set up so it is recognized by any file browser. It's also running Avahi so you can connect to it simply through its .local domain. It really does it all, even while running off a phone charger drawing near-zero power due to its efficiency and low resource consumption.

This flake is a submission to Hack Club's Riceathon

Clone this wiki locally