Probably one of the biggest roadblocks for people who want to use Linux is its complexity. And those people are not wrong Linux is quite complex compared to your typical macOS or Windows(eww).
Unless your using Ubuntu then you will most likely find Linux can be quite unstable, just one system update and whoops my Arch setup isn't booting the graphical environment anymore!
That was me during my first two years of Linux, constant issues, every update was like poking a sleeping bear to see if it would wake up, sometimes it did..
But now that the preamble is covered let's talk about what you really came here for. A Linux distro that fixes everything we have covered so far. No more worrying about your system breaking when you update, no more needing to write massive bash scripts to recreate your system if you ever need to install again, no need to write documentation for your own system just so you can remember how you fixed all those issues!
I present to you all, NixOS. A fully declarative distribution, where all packages can be individually controlled and version locked to get exactly what your system needs.
What is NixOS?
Ok well lets break that down, "what do you mean it's declarative?". Well most Linux systems are 'imperative', you have to do many things in succession to accomplish your system which results in those long bash setup scripts we all have seen at least once.
Whereas a 'declarative' system means just about everything in the system is controlled by a few configuration files, "Oh but Jasper that is literally every system, its called dot-files", well yes and no.
Dot-files on most system are your window manager, terminal and other configs but on NixOS you actually combine every single modification to your system in a small set of files or even all of them in one single file!
How NixOS works
Here is a quick example, on most systems to setup your timezone you would have to either run a command or change a system file, just take a look at the Arch Wiki on changing the time. But as you can see below on NixOS its controlled by a single line in your sole system configuration file.
time.timeZone = "Australia/Sydney";
And this is just one example, with NixOS all you need is a single .nix
file and your can do just about anything you could do with a few hundred commands on another distro.
And let's say you have made this massive config, well now you can run that config on ANY other system and it will be created the exact same it was on the original system thanks to NixOS's version locking, which we will look at soon.
So once you make a change to your config you just run the nixos-rebuild
command and then pass in switch
if you want to apply the changes to your system immediately, boot
if you want to apply them at the next boot, build
if you just want to build without applying any changes and EVEN build-vm
which lets you build a virtual machine of your system to test if the changes work without actually testing it on your system.
The last thing I'll mention is that on NixOS whenever you install a package, (which is done by simply adding the package name to your config) that package is version locked and can never change unless you update your system or specify another specific version of the package, no more needing to worry about a package updating and breaking without your knowledge!
Conclusion
After using NixOS myself for a few years now I have never had a single problem with my system that couldn't be easily solved by making a quick change to my config.
While NixOS has a steep learning curve it is well worth it. But don't fear there are alot of great resources on how to start with NixOS. In fact I have written an entire documentation page on NixOS with links to plenty of helpful resources to get started.
Check it out here and make sure to share it with others, I frequently update the site with new content!
Top comments (6)
Interesting! - Obviously though, the perceived "complexity" that Windows and macOS users refer to is not what you fix with NixOS: You still have to make friends with the terminal. That's a given, isn't it?
How do you manage software updates, though, in NixOS? Who takes care of security updates, new versions of software XYZ, etc.? If configurations are maintained by contributors in the open source how will you know that you should update - when the tedious nag boxes are presumably missing that prompt you for updates?
Very true, NixOS doesn't solve the complexity problems entirely. But it provides a better method of system management compared to even WIndows, macOS or other Linux distrobutions, (in my opinion).
Software updates are managed by the NixOS community through the Nixpkgs repository, but you can become a maintainer of the repository like I was for a while and request package updates yourself. And then of course you don't even need to rely on Nixpkgs because you can build any package locally using the nix language and syntax for creating packages/derivations.
If your interested to learn more please check out my documentation on NixOS, there is a ton of information to get started docs.windswept.digital/nixos.html
In other terms, is Nix actually an alternative - somewhat - to Puppet, Ansible, and other configuration management software?
I found Misterio77's nix-starter-configs on GitHub, which explains how to handle configuration drift. I'd love to better understand, whether Nix can fully replace Puppet, ideally in combination with a user-friendly management front-end, such as The Foreman, to track the configuration state of all your machines.
I'd say NixOS is more the original than an alternative! NixOS was released in 2003 but tools like Ansible were not released until nearly a decade later. A bit of a side note but I personally think NixOS inspired tools like these!
Your research certainly seems interesting. I should let you know I'm making another post tomorrow which covers why and how NixOS should be used for a home server, and then 2 weeks from now I'll be posting a full step-by-step guide to setup NixOS so look forward to it!
I love NixOS and I hope it wins out, but I quit using it when I decided I'm just too stupid for the Nix language. I really don't know what it is--people say it's easy if you know other functional languages, but I know and love lots of functional languages and just absolutely cannot grok anything about Nix lang.
I think the Nix language is not hard its just how NixOS uses the Nix language. I still find myself browsing the discourse everyday just to find out how to specify a package version for the 20th time XD