Setting up my homelab and cloud with Nix

Posted on ·

I have been maintaining a set of cloud servers, for the purpose of selfhosting a ton of software, VPNs, and random experimentation. Recently, I bought a Dell Optiplex 3040 for Rs. 5000 ($60), and I am planning to revamp all my scattered scripts and make orchestration easy for a one person team.

Tradeoffs

I have a pragramtic approach to selfhosting. Until now, I have only used traefik 2.0, docker-compose, caddy. I do have lots of services running and I wanted an orchestration solution which is flexible. Web apps are mostly running on cloud native technology nowadays, and so Kubernetes stood out easily.

As a selfhoster, I can foresee changes in infrastructure less often, and so I don't exactly want to treat my servers as cattle. I want to be able to audit everything and easily onboard new hosts though. Ansible is a good option, but it feels like a leaky abstraction for IaC. I am going to go yolo on nix and see how far it can take me.

Concepts

I have had multiple scattered thoughts on what designs fits best for my needs, and I have realised:

With a setup like this, I will be able to setup new servers and handle any sort of load pretty quickly. The good thing with nix is that we can also have tiers based on how much control I want to give to new hardware, I might just want my normal terminal session on a contract work's server.

Dev logs

I am going to start blogging about my journey, here is timeline i'll keep updating: