My experience when switching to NixOS - Part 1

This will be a series of blog posts about my experience when switching to NixOS, the Purely Functional Linux Distribution.

It will cover everything: The successes, the issues, the problems, everything you can imagine, including my personal NixOS configuration, so you can learn how to get your feet wet with this blog series.

But, of course, this is not a tutorial on how to write Nix or how to use NixOS. This is an experience report.

The Why

So, why did I switch or do I want to switch? I’m a Archlinux user for more than 7 years now. Archlinux is a great distribution, you can tweak every single bit to fit your needs perfectly. It is truly awesome. But there is a problem with it, I don’t want to have anymore: You can really easily break things. You can break your packages by upgrading a version of a library. You can pollute your package database by installing something and shortly afterwards removing it, but forgetting to remove the dependencies it pulled in. You have no option to actually tweak packages. You want emacs? Okay, here is emacs. You want it with GTK3 instead of GTK2? Then, compileit yourself. (I picked emacs as example here because that’s the one example on the NixOS page, there is certainly a package for emacs with GTK3 in Archlinux)!

Another big selling point for me is, that NixOS comes with either the stability of Debian, if you want it to, but you can be bleeding-edge like Archlinux if you want to. It’s in your hands with NixOS!

Of course, in NixOS, you only have one configuration file for all the things!

Configure all the things!

The How

So, I started playing around with NixOS in a virtual machine. I started with a minimal configuration which is shipped with the system. Of course, I read a lot of blog articles beforehand, so I almost knew what I did. Well, at least I thought, I knew it.

There are great resources online. Well, there are not that much resources around, but at least the ones that are there are really good. My starting point, of course, was the NixOS homepage, the NixOS wiki, but also the great blogging series Nix Pills which explains the Nix language.

What was also worth looking at is the real world NixOS Dotfiles page, where links to dotfiles of NixOS people are collected. Mine are not up there, because I tend to keep my dotfiles private, so you won’t find them there. But you find them here!

The requirements

My requirements for NixOS should be listed before I go into detail how I managed to get things done.

Configuration files

So, first, I wanted to be able to track my configurations with git. I track all my configurations with git, as this enables me to mess around with them without actually losing them/information/knowledge/bla. I think you get that point.

Well, that was not much of an issue, actually. I just created a new folder in my dotfiles directory and linked the global NixOS configuration file to it:

mkdir config/nixos
sudo cp /etc/nixos/configuration.nix config/nixos/
sudo chown $USER config/nixos/configuration.nix
sudo mv /etc/nixos/configuration.nix /etc/nixos/configuration.nix.bkp
sudo ln -s config/nixos/configuration.nix /etc/nixos/configuration.nix

As you can see, I backuped the configuration before overriding it, just to be safe here.

Well, this actually works out really well. But! There is a but!

When installing a new machine, you actually cannot do this, because your NixOS installation doesn’t know of /home yet (as it is not mounted at this point). To work around this, you simply use the /etc/nixos/confuiguration.nix file until you have set up the basic system!


I also wanted the configuration files to be shareable between several machines, which required me to split them up into several parts. I already described this in another blog post!

KDE!

Well, packages. As I described in the other blog post mentioned above, I have several sets of configuration which I merge into eachother to compile the machine-specific configuration out of several parts then. This works really well and I use it every day!

One big thing I wanted to have was KDE. Yes, me, the Archlinux-i3-minimalistic-terminal-only-loving guy tries KDE. Why? Well, that’s another topic!

Turned out that KDE works really good for me! I tweaked some shortcuts, so I’m able to do “tiling” with it (but not with this ugly “Tiling” script for KWin, actually!) so it works really well for me and I really like it.

But there also were some problems, I will tell you later on.

Services

For the services department: I want to be able to run a gitolite instance, I already run a ssh server, synergy (client) and redshift. I did not try the synergy client on my latest install, but beforehand it worked, so I assume it still works. Redshift and ssh work, so that’s none of an issue.

What does not work is gitolite. I don’t know why, yet, but I will do some further investigation on this.

Overall requirements

Well, one big requirement for me is that things just work. I did not write “work out of the box”, because this requirement was already destroyed when this blog article was written. I don’t want to mess around with things every now and then - I want them to work, so I can be productive in things I actually want to do.

So, that’s also the reason why I wanted a switch to KDE. I want to use the Kontact suite, including KOrganizer, KMail, KAddressbook and not mutt with abook anymore, which works, but is not that great IMHO. I mean, mutt, yeah! It is awesome and fast and everything. But I cannot do contact managing, scheduling, etc with it. As an email reader it is the best piece of software I ever used and in combination with vim, it becomes even more awesome! But it does not integrate with other tools like an adressbook or day planner.

Also, all these things can integrate my Android phone, which is awesome. I did not try it yet, though.


So, that’s enough for the first part. In the next part of the series, I will describe my steps from zero to a basic system and how I installed the configurations and things. Maybe the post will also cover my first problem with NixOS.

Stay tuned!