Hacker News new | ask | show | jobs
by tombert 436 days ago
I run NixOS on every computer I'm allowed to install it and I really don't think it's hard to use, just different. Adapting to a new workflow is hard, but I don't know that NixOS is intrinsically more difficult than any other Linux.

I wouldn't want a docker container as my main environment, but I do like having NixOS managing my main environment for a few reasons.

First, the declarative nature of everything makes it clear and easy to know what is actually installed on my computer. I can simply look at my configuration file and see if a program is installed, and if it's not. If I want to uninstall something, I delete the program from the configuration.nix and rebuild. This might not seem insignificant, but to me it's game changing. How many times have you uninstalled things in Ubuntu or something and had a ton of lingering transitive dependencies? How many times have you been trying to debug a problem, end up installing a million things, and then painstakingly having to track down every unnecessary dependency and transitive dependency that you ended up installing, only to miss something for months? Maybe most people here are better at this than I am, but these things happened to me all the time.

Second, the declarative nature of NixOS makes snapshotting trivial. Again, this is game-changing for me, and it makes fixing stuff on my computer more fun and less scary. If I break something, all I have to do is reboot and choose the last generation, then fix it.

This might not seem like a big deal, and again maybe for people smarter than me it's not, but for me it completely changed the way I deal with computers. When I first started using Ubuntu, when I would do something like break the video driver or the WiFi driver, I would end up having to nuke the system and start again, because I would get into a state where I didn't know how to fix it. I probably could fix these things now, I've been doing this stuff for awhile, but even still, it's nice to be able to not ever have to worry about getting into a state like that.

3 comments

My biggest gripe with Nix (from real world experience) is that my .nix files randomly break due to changes and I have to spend my time going through Github commits to see what changed in the settings I used to fix it.

That and when things do error, the error messages may as well be generated from /dev/random

Are you importing things from all over the internet, without pinning to a specific version? It sounds a lot like it, at least, and in that case I'm not sure how this is a flaw of Nix, or how it would be much different in other places.
To be fair, you get this all the time when you run nix-channel update, "<whatever> has been deprecated/removed, use <something-else> instead".
Nix channels (and NIX_PATH) break reproducibility. Pinning revisions makes things more robust; my preferred approach is to use default function arguments, so they're easy to override (useful when composing lots of things together).

It seems like flakes are another way to do that, but they seem way too over-complicated for my taste.

Yeah of course, but channels probably shouldn't be used outside of managing the local machine, and there's usually quite long and fair time period for deprecation warnings taking effect. Not sure how bad if one uses unstable, but if using unstable the complaint isn't really fair to begin with.
What you describe with building and rebuilding and keeping a clean environment is exactly what I use Docker containers for, eg devcontainers. I know it’s not reproducible in the same way, but the learning curve is so, so much lower for something 90% as good and with much more documentation and online support.
It is not the same as docker though. Docker is fine, but that would only work with application level stuff. NixOS lets you manage the entire system this way, including drivers and kernel modules and everything else.

This is not a small difference.

That’s the 10% that Docker can’t do, indeed. But most of what I want to do is handled fine by the area where Docker and Nix (not NixOS) overlap.
I am saying that’s more than 10%, it’s fundamental to the entire NixOS experience.
> I run NixOS on every computer I'm allowed to install it and I really don't think it's hard to use, just different.

I work at a place that uses Nix for almost everything. Despite that, most developers do not like it (and usually create tickets asking the "experts" to fix things). The above quote is basically exactly what the experts are always telling the developers. That, along with "you just need to try harder." As if it's not valid that someone can think Nix isn't ergnomic and often sucks to use.

I personally don't mind it all that much, although nowadays I just use it for home-manager. But I've seen people go from disliking it to hating it because of the way some experienced Nix people have treated them.

I mean people might be dicks about it, but I stand by my point.

It’s inherently hard to learn new things, especially if they’re contrary to things that you’ve been doing for N years, so I understand frustration, but that doesn’t imply that Nix itself is more difficult than anything else.

There are plenty of things that aren’t inherently difficult for most humans, but are hard to learn simply because they’re different. I don’t know that Spanish is a more difficult language than English, but I would have trouble learning it just because I have spent my entire life speaking English and approximately none of it speaking Spanish. This doesn’t mean Spanish is more difficult than English.

I will agree that the Nix language itself is kind of a pain in the ass with wonky syntax, though I have grown to kind of like it begrudgingly.

That's fine. I'm not trying to convince you to change your stance, simply bringing a perspective of Nix being used in production in a company of 500+ engineers. It's not an exhaustive example, but I've always used it as a data point of the general dislike of Nix I see across the board.