Hi everyone, someone can explain, in simple words, why considering to switch on NixOs over other distro? And the use case? I think would help a lot of people (including me) to understand it better :D
The reason I really like NixOS is it’s by nature very robust. Your config is the almost universal truth about what’s installed on your machine and if it works
For example, if I make some change that breaks my whole system, I simply boot off the last working build, then revert my config to the previous version in git
Also, if there’s a package in the nix package manager you can say with 99% certainty it will just work out of the box, and if it doesn’t there’ll be a config option you can enable to get it to work
Also also if you move to a new machine you can copy over your config and the machine is built up just how you like it right out of the gate
Also also also if you do software dev you can have development environments that have all the packages you need for that project and only those packages
Also also also also you’re not gonna run into the issue later down the line of having loads of random shit installed on your system in 3 different package managers and 9 different places, cleaning up your machine is as simple as just removing the entries from your application list
Stupidly easy to install things too. If you want to install gnome desktop as an example it’s as simple as adding
services.xserver.enable = true; services.xserver.displayManager.gdm.enable = true; services.xserver.desktopManager.gnome.enable = true;
To your config
The main difference of NixOS to other distros is that you configure your system declaratively. This means that installed system settings (e.g. user accounts, enabled drivers, etc.) programs and potentially also configuration for individual programs is all defined in a single place. The disadvantage of this is that a lot of stuff works differently than on “normal” distros and that it tends to have a rather steep learning curve. Unless you’re prepared to invest a significant amount of time into it, you should not install NixOS.
That being said, the topic is a lot more complex (for example, one can also use the Nix package manager on other distros than NixOS), so if you’re interested, here is some more discussion on the topic:
I feel like some NixOS users miss the mark and end up saying a bunch of buzz words or a list of features without describing the true value of NixOS because they are presumably too enamored with such a magnificent creation. I run NixOS on two machines currently and have been running it for around 6 months.
The use case for NixOS is for extreme stability and organization while preserving customization. You can, like many in the comments have already described, setup entire desktop environments in a few lines of Nix code and know everything your system has installed and configured at a glance (makes maintaining wayyy easier). However, all of this customization takes time. You might find really easy when doing one thing, but really hard and seemingly unnecessary for another. Notably, installing software that hasn’t been packaged for Nix yet can vary in difficulty when taking into account the different languages used to make it. How one of my friends said
I would genuinely love to use it more but it takes the “Linux is free if you don’t value your time” meme to the max with the learning curve
As for the two systems of mine running NixOS, one is a desktop computer I run as a server, and the other is an effectively a school laptop. I don’t intend changing their configurations all that often in the future because they’re just supposed to work without the need to maintain them. For NixOS there is always an added step when trying to do a lot of things, and that is why I don’t run it on my development/general computer. If I want to install or try out a newer piece of software, I don’t want to go through the gymnastics that one must on NixOS. I just want to install whatever development libraries exist, build, and run it. That doesn’t mean I don’t like NixOS, but my use case for it are systems that need to be stable and reproducible since I put a lot of time into setting them up.
Recently, my school laptop’s cheap hard drive that randomly disconnected got corrupted (who would’ve guessed), and so I reinstalled NixOS and my configuration on a newer, better drive in a matter of two hours. All of the software I had even packaged myself installed perfectly on my system with no problem. Almost nothing had changed and everything worked great.
So, in conclusion, NixOS is awesome, but its not for everyone and its not for every use case.
I wonder in practice how easy it is to copy your nix config to another machine. Sounds amazing but aren’t the configurations very hardware dependent?
Having tried it on multiple different it’s not seamless but it’s a damn sight better than setting up many machines manually
The configurations are not particularly hardware dependant as for the most part NixOS handles drivers and such transparently and just gets whatever it decides is best for your hardware (unless you override it)
The main hardware specific config I have is to use Nvidia proprietary drivers, as it defaults to nouvea
Tl:Dr 90% of your config will transfer and you have to do a little fiddling to get it all up and running but it’s all way easier than building from scratch
This is very true. However, most of the time you’ll regenerate the hardware configuration using one command and use that instead.
Nice! If I ever have the time, I will try it out! I have been running arch with the lts kernel for a few years now but NixOs does seem very cool