This repo contains Nix files that I use to build bootable images for machines in my homelab, both virtual and physical.
I use Ganeti for cluster management and KVM via qemu to run virtual machines on top of it. There are four nodes in my cluster, each one running on Dell Optiplex Micro 7040.
These nodes boot NixOS images over network. I build and deploy these images using files in this repo.
-
nix
contains sources pinned by niv. I'm usingnixpkgs-21.11
to build Ganeti, as most dependency versions roughly match. Notable exceptions are qemu, iPXE image and drbd-utils, which I cherry-pick fromnixpkgs-unstable
. -
ganeti/default.nix
is Ganeti 3.0.2 derivation. -
ganeti/os-providers/default.nix
is an attribute set of derivations of Ganeti OS providers. So far I only make use of ganeti-os-pxe that I modify to write iPXE BIOS NBP fromnixpkgs-unstable
to disk instead of custom Etherboot NBP that is provided in that repository. -
ipxe/netboot.ipxe
is the main iPXE script that machines in the homelab run first when they boot. -
nginx/default.nix
is a derivation that contains a container image of nginx that runs on MikroTik ax3 router. I use this to serve iPXE scripts and NixOS images. -
nixos/default.nix
contains NixOS image definitions that I call classes. Each class represents a different image. Right now there are:ganeti-node
that nodes in the cluster boot from; this is the only image that physical boxes usenavidrome
for Navidromecalibre-web
for Calibre web server
Disks are provisioned with disko, and root and host keys are provisioned through a systemd service. Once host keys are in place, I use agenix to decrypt and deploy secrets.