Why is NixOS considered difficult if you've never used it?

I’m using Ubuntu (KDE Neon) as my daily driver right now, and looking at possibly switching to NixOS because I hate all the broken packages with apt and not having up to date packages, etc. But a lot of the things I see online seem to say that NixOS has a steep learning curve compared to Ubuntu. Why is that? I’ve never used Nix so I don’t know.

From what I can see, there’s a CLI for the package manager - nix-env, and perhaps snow although I’m not sure about what exactly it is. There’s also GUIs - Nix Software Center, NixOS Configuration Editor, and Nix-Gui. With these things, wouldn’t it be a pretty similar experience to Ubuntu?

Or are there common use cases that aren’t yet covered by these things and are confusing to people not familiar with Nix? Is it hard to install applications that aren’t in nixpkgs?

2 Likes

One of the big differences is that a lot of things in NixOS must be done in a declarative way.

Managing your user environment with nix-env is pretty similar to installing packages with apt, but drivers, services, anything that must be installed on a system-level cannot be installed this way.

For these things, you have to modify the nix configuration, which is written in the Nix language, a functional programming language.

If you’re only familiar with JSON, YAML or INI files and maybe bash scripts, the way the configuration gets evaluated can be pretty surprising. As long as you’re only configuring simple things, this is not a problem, and the GUI tools you linked help a lot with lowering that initial barrier. (I also want to mention noogle and MyNixOS at this point, they are amazing resources that you’ll use a lot.)

But once an unexpected issue shows up, many of the usual tutorials and guides to solve the issue will not apply fully on NixOS. There will come a time where you’ll have to learn the Nix language, the NixOS module system, intricacies about nixpkgs and subsystems like python3Packages and many more.

This can be very frustrating, but it can also be very exciting, depending on what kind of person you are. For me it’s both. NixOS solves many issues that other distros can’t even dream to take on, and learning it can feel like you’re gaining a super-power. But you will have to stay flexible in your thinking and not assume too many things, read documentation, forum posts and wiki articles.

Finally, a word of warning about GUIs and tools that build on top of nix; they can be very useful, but they are all very leaky abstractions that can only get you so far. You’ll also notice that many of them are maintained by one or two people and don’t get a lot of updates. If push comes to shove, understanding Nix itself will help you greatly in solving problems yourself.

12 Likes

For me, the breakthrough came when I took a step back and decided to understand the Nix language itself. Diving straight into the package manager, or trying to configure NixOS, was very confusing before that, as every change required magical incantations in a weird language, leaving no room for me to do any more than copy exactly what I read.

Once I slowed down, learned how the language worked, then the OS configuration suddenly made a LOT more sense, to the extent that I now fully enjoy writing new Nix configurations and can make changes without searching online or memorizing syntax.

Some of the Nix language resources I used:

3 Likes

But a lot of the things I see online seem to say that NixOS has a steep learning curve compared to Ubuntu. Why is that?

This is a legend entertained by people who are joining with expectation of seeing yet another distribution.

NixOS is different than any other distribution, and if you are not ready to put your expectations aside (“There is no spoon”), it is hard to grasp.

NixOS is actually easy to use, it is made to favor copy & paste between users compared to reading very long blog post which are trying to guide you through the various files and commands to be pasted.

Mastering NixOS is difficult, it has multiple decades of history and legacy. It wraps configurations of programs to provide better integration across programs. It is attempting to work in a world which is not made for it, with standard which are built with the idea that “spoon” do exists.

Many people would see NixOS as difficult because they come with a background of being able to customize their distribution at Master levels, but fail to acquire the same Mastery in NixOS as quickly as they had wish for. This is where this legend comes from.

This legend would progressively vanish in the upcoming decades as more people would become familliar with it, provide more and more configurations with sane default, and provide external set of tailored user experience for NixOS users.

Today, NixOS has the potential of being the best distribution for any hardware given: GitHub - NixOS/nixos-hardware: A collection of NixOS modules covering hardware quirks.

What the NixOS community should focus on next is building a collection of nixos-software default configuration, where one can have the best integrations of the KDE suite / Gnome suite / ActivityPub services / Matrix server&bridge / … with secure default and minimal configuration from the user point of view.

6 Likes

That, and fully transitioning to flakes everywhere and updating all documentation to match. :slight_smile: I got stuck for a LONG time, trying to learn NixOS, just from trying to understand what I needed to do with flakes despite the majority of documentation pushing channels up front. (the whole “I want to use flakes, but these instructions don’t use flakes, so I shouldn’t use them, so what DO I use?” issue)

There are a lot of good resources for using flakes up front (Wombat’s Book of Nix is excellent), but I wish they had been more easily discoverable when I was first starting and didn’t know what to look for.

5 Likes

That’s definitely another part of the “difficulty” of NixOS - it’s hard to call the ecosystem mature. There are lots of moving parts, and exciting development is ongoing. Other distros are much more boring, making it harder to get confused or stuck on guides that disagree.

And should almost never be done because nix-env integrates poorly with NixOS and itself is just not particularly well-designed. It’s like an apt that sometimes does the opposite of what you asked it to.

I appreciate that it’s often recommended to newcomers because it’s apt-like and intended to feel familiar so exactly the users @iFreilicht describes don’t get alienated, but it’s such a footgun - especially for those who don’t yet understand what it does - that I don’t think it’s a helpful suggestion, at least to those who are curious enough to actually learn a bit and ask around on this forum.

Case in point on disagreement, by the way.

4 Likes

(Edit: Sorry for the necro. This was a suggested post at the bottom of one I was posting in. I should have checked the date!)

I’ve used Ubuntu and Mint in the past, and found them to be pretty terrible from a user experience. They are only easy to use until you want to do something marginally interesting. Then you run up against outdate and broken packages, as you say OP, and the guard rails in place to make for a supposedly easy newbie experience are inhibiting to the extreme.

By contrast, switching to Arch (yes, this is the NixOS Discourse, I know, but my journey took me next to Arch) made things remarkably easier. Once you’re in, you’re good.

Now, I’ve only been using NixOS for a few months, and even then, only in a limited capacity, but I imagine it’s not too different. NixOS is very different from any other Linux distro I’ve used, but that isn’t necessarily a bad thing. I think it’s a case of a lot of up-front difficulty, kind of like how all the difficulty with Arch is installation. If you can install Arch the Arch-way™, then you’re in for a pretty easy time of things. I can’t claim the same of NixOS quite yet, but I can say it looks that way. The actual installation process was one of the smoothest I’ve experienced, but once in there is a fair bit of configuration. I think once I’ve finish that configuration, I should be set for a very long time, however.

My main reservation is the documentation is lacking, which means you need to lean on the community, but that community is small making it harder to get help.

For me the hard part with Arch was keeping it alive.
Updates could be quite interesting.
With NixOS it is quite the opposite, of course options get depreciated when a new release comes out but once you fixed them and your system builds you’re good to go.
In between updates are rather boring even when you use certain packages from unstable.

1 Like

I am so looking forward to boring.

1 Like