Nix (Part 1): Starting a Journey
...I'll get back to the homelab story at some point, but those of you who know me personally should already know that finishing personal projects isn't one of my strong suits.
To that end, I've started a new personal project - learning Nix.
What is Nix? It is:
- a functional programming language
- a "package manager"
- a software build system
- a way of declaratively describing systems
- a way of declaratively defining/buidling systems
- an operating system built around these concepts
Which, frankly is a lot.
But, the idea of being able to rebuild my workstation by running a single command is pretty attractive. Being able to define how I want the VMs in my homelab operate as code (rather than with code like one could do with Chef or Puppet) is even more attractive...because, frankly, there's relatively little persistent data and being able to do more hardware/hypervisor testing is pretty attractive if I can recreate the VMs deterministically using a small shell script and some code.
To that end, with my new Framework 13 laptop, my initial intention was to only ever run NixOS on the machine and truly live that declarative lifestyle.
However, NixOS still has some sharp edges and I got pretty frustrated pretty quickly, ultimately wiping NixOS and dropping on my good ol' standby Archlinux for now...installing the Nix language/package manager in Arch, and learning more with the goal of ultimately having this laptop run NixOS with an encrypted BTRFS root filesystem, suspend to encrypted disk, and the TPM of the machine automatically unencrypting the volumes and secure boot validating that the TPM hasn't been tampered with.
A bit paranoid? Yep, that's me.
A bit lofty of a goal? Sure as shit seems like it because I definitely wasn't able to get that working in 2 days (with very limited Nix experience).
However, it seems like because the official Nix docs are obtuse as fuck and written like the academic paper the whole system is built around, having another blog series of how a mere mortal (and in my case, one who doesn't have a background in functional programming) learns this shit and ultimately gets to having multiple systems (both physical and virtual) defined as code seems like something which might get me both to follow through with the project as well as get back into the swing of writing here regularly.