Why is my life declared by nix?

Andrew Fontaine <andrew@afontaine.ca>

If you’ve taken a peak at the source for this site, you might have noticed a flake.nix file sitting squarely at the root of the project. I’ve been using NixOS on my home lab for about 5 years now, although poorly until about 2 years ago, and for the most part I’ve enjoyed my experience.

How did it start?

When I was initially playing around with Linux, Ubuntu was my starting point, as is often the case. It was thrilling to not boot into Windows, but some other system. It was also pleasing to be able to (much easily) complete my school work without sitting in the CompSci labs, instead finishing them from the comfort of the campus bar. One of my friends had some spare computer parts and set up a home server so we could play Minecraft together, and his biggest complaints were around 2 things:

  1. configuring everything is a pain, and
  2. big upgrades break everything.

When I finally got around to needing my own server, I explored the distribution space, looking for distributions that tackled those two points above all else, which, somehow, lead me to NixOS. What appealed most to me was that configuration of most everything was handled in one configuration.nix file and not several files scattered throughout the /etc folder.

Originally, I used NixOS very minimally. The most advanced feature I utilized was to set up my own SystemD service, which ran docker-compose in a specific folder. Not very nix-y, but we all have to start somewhere.

How is it going?

Since then, my home server, laptop, desktop and VPS are all running NixOS. My usage of nix has also expanded to encompass my dot files via home-manager, manage secrets with sops-nix, and configure my work macbook via nix-darwin. I manage the VPS through the awesome deploy-rs tool, and deploy this site to it using flakes, the concept that really made everything click.

Now it’s no issue at all to spin up a new service on my VPS (like this blog!), or add new programs to my user configuration, or update my desktop and laptop to be in sync with each other, configuration-wise. As long as I remember to actually commit and push changes, pulling them onto another machine is a breeze.

Sure, there are some struggles when it comes to dealing with the macbook, but nix is also a programming language, which means expressions, conditionals, functions, and all the right tools to separate what doesn’t work on the macbook with what does.

I’ve found that Nix has helped me simplify my management of all my computers, and if I could manage my fridge with it, I could.

Inspired and itching to try nix out? I recommend checking out:

This was a pretty high-level overview, of “why nix”, with none of the fun technical details, and while this didn’t get technical at all, I think once I get into the swing of writing again, I’ll be getting more technical in posts again.

Want to discuss this post?

Reach out via email to ~afontaine/blog-discuss@lists.sr.ht, and be sure to follow the mailing list etiquette.

Other posts