NixOS gushing

nix ops dev 2022-04-16 18:53

NixOS is fucking crazy. I can define, in a single file, all of the following:

  • My SSG builder, that takes python files in the same directory, and turns them into a package that can be used on nixOS
  • Another nixOS package that takes my builder, gives it my notes files (from a different git repository) and provides the html output
  • A development environment for working with and editing my python based SSG
  • A nixOS module that configures nginx, takes the previous package that built the HTML of my website and starts up a webserver
  • A container based on nixOS that runs only the previous module to test it out locally without messing up my current system

No other system (except Guix) provides so much opportunity to automate software development. In fact, setting up all of these in a way that is ensured not to break across various environments and still be easy to on-board new developers is a real job that engineers have.

Coupled with direnv I can load my development environment as soon as I'm in the directory. It's really hard to go back to the old way of configuring machines, development environments, and packaging software now.

To be fair, I'm only just beginning to harness all the different parts of nixOS in a way that makes me productive. I've been using nixOS for nearly 2 years now, and using it exclusively for over a year. It's not easy to get acquainted with the ways of nix. And to be totally honest, I still don't understand so much of nix, and can barely write any nix code at all (I literally could not write a nix function if I did not look at any examples).