NixOS and other tools
Note: This blog post is old and many things here have been changed and moved on. I will write another post to update.
You can see my NixOS and Home Manager configs. This is a big deal!
Years ago, I moved to the Apple ecosystem for stability and things like the Time Machine backup system. That is still where my personal computing lives. But I was getting more and more worried about having personal data on the same machine where I download and run code. I was hoping to separate my development setup from my personal computing setup. I could have gone the route of QubesOS but back then I was not ready to shave more yaks than what I was already helping groom. So, I decided to buy a laptop and have been running Ubuntu on it, up until a few months ago, when I removed Ubuntu and moved to NixOS.
For years I have looked at way too many tools to have a decent backup and restore strategy and nothing stood out. I can manage to backup my home directory and restore it but I needed something that helped reliably reinstall all the applications, dotfiles and other tools that I need day-to-day. Then I can just reinstall in case of a computer crash and fetch the home contents from a backup. This is where NixOS helps. In short, it is a Linux distribution that is based on Nix, a purely functional package manager (it is also a functional programming language). This allows your installations, upgrades, etc. to be atomic, which makes them much more reliable. That is, every time you install or upgrade, NixOS creates a new snapshot. You can clean older snapshots when you feel like it or boot into an older one if you wanted. There is also home-manager which is userspace Nix. I highly recommend you look into that as well.
For those interested here is my Nixos and Home Manager configs. I can give a quick run down.
This is needed because I want to be able to override certain packages and have the config live in my home directory rather than the default
This is where I store the root configs for various machines. A root config is your
hardware-configuration.nix that is created the first time you bootstrap while installing NixOS. You can use
configuration.nix for everything but it is better to have some semblance of order. Programmers, eh!
I have three development machines and at the time of this writing, two of those are on NixOS. Yes, I love wolves and yes I came up with the name Torontula.
This is mostly common stuff for all machines without having to make duplicates. This could go into a
configuration.nix but I chose to move it into its module.
- This file defines the
unstablebranch of Nix because certain packages are only available in that. At the time of this writing, I have Zulip which I needed for Rust's official chat. Note that you can define
revisionand fetch only that. Talk about thinking of pinning from the ground up.
- It installs Virtualbox and related services. Yes, I need this on all machines and it takes horribly long to recompile.
- When was the last time you defined a font in the config? Or created a user in the config with some Puppet/Chef/etc.? ;)
- Oh, look at the desktop managers here.
- Ahem! Manager your config files. The confs live in a separate directory.
- This entire section is the list of packages I want to be installed. I add and remove most of them here and run the rebuild command.
- When was the last time you managed your git config and settings like this?
- Do you use emacs (or even vim)? Here is the list of all the emacs packages that I use. Some of these are directly from Spacekookie!
- Change your Linux Kernel in one line.
- I moved to fish shell; again thanks to Spacekookie from whom I stole this entire set of functions.
- I moved to Alacritty as my main terminal emulator. Here is Alacritty's config YAML and here is how you "install" Alacritty's config It is truly faster than any other terminal emulator I have used.
- If you like QubesOS, you should check out SpectrumOS. It is like QubesOS but based on Nix. I am excited about this and I wish I had time and knowledge to contribute to this project.
If you want to get help, folks on the NixOS IRC channel are very helpful!