The NixOS learning Curve

Reading Time: 3 minutesWhile walking and listening to podcasts I kept hearing about [NixOS](https://nixos.org/) and how good it is for instantiating environments over and over again. What I didn’t hear about, so much, is that there is a steep learning curve, to get started with.

Installing the OS is easy. Download NixOS, flash it to a USB stick, reboot a computer onto the OS on that USB stick and begin installation of the OS.

## Changing Desktop Environments

So far, so easy. I chose to install NixOS with XFCE out of curiousity but once I booted into the environment I felt confused. I struggled to find the way to go from using XFCE to Gnome as an environment. Eventually I managed. You mark the old Desktop environment as false, and add the new one as true. You then send the build command. When you reboot you have the option of booting into the old build, or the new one.

## Learning How NixOS works

I tried to install Nextcloud and PhotoPrism but that’s where I met resistance. The first challenge is to understand how the configuration.nix file is set out. In the end I managed to get Nextcloud to boot but failed to get MySQL to work properly.

I expected that by switching to NixOS I would find tutorials and it would be easy to transfer from Ubuntu/Debian to NixOS but it isn’t.

The Nix Package manager expects familiarity with NixOS, which I don’t have. I spent time trying and failing, until, after a few searches I found some instructions on how to install Nextcloud on NixOS but I’m only part of the way through the guide.

As I progress I’m running the script, to see that there are no errors before moving onto the next part. I am now on the learning curve, but not very far along.

## The Desired Goal

From what I have heard in podcasts the advantage of NixOS is that it makes replicating a setup easy. If, and when, I get Nextcloud and PhotoPrism to work on an instance of NixOS I can easily duplicate the system as many times as I have devices. Instead of installing Nextcloud, and then installing PhotoPrism, CUPS and other apps I can prepare a configuration.nix file and duplicate that system, over and over.

## Easy to Recover

With some OSes if you make changes and break something it could take hours to recover. With NixOS you make changes but you don’t have to learn to live with them. You can revert to a version that you liked, or move on to a new version that you prefer. If you experiment and fail with something, you can easily iterate, until it works.

Now I have one build with XFCE, another with Gnome, and a third with VIM and Thunderbird installed. There are more versions where I am trying to get Nextcloud to work. Last night I stopped iterating through experiments because it was time to prepare dinner.

## And Finally

[Nix Learn](https://nixos.org/learn) exists for those who prefer to take a methodical approach to learning. It has three parts. “Install Nix”, “First Steps with Nix”, and “How Nix Works”, for the more methodically minded learners. I thought documentation would be easier to find, and the OS more intuitive so I tried to sprint before I learned to stand up.

Due to the learning curve I know that I need to devote time to learning to use NixOS properly. I should know most of the concepts from playing with Node, Ruby on Rails and other solutions. It’s a matter of applying that understanding to this context.

I want to spend more time on this in the near future.