Why everyone is switching to NixOS ?
Why everyone is switching to NixOS ?
Hi everyone!
I saw that NixOS is getting popularity recently. I really have no idea why and how this OS works. Can you guys help me understanding all of this ?
Thanks !
Why everyone is switching to NixOS ?
Hi everyone!
I saw that NixOS is getting popularity recently. I really have no idea why and how this OS works. Can you guys help me understanding all of this ?
Thanks !
NixOS is the only[1] Linux distribution that feels like it is build around Free Software. Meaning upstream Git repositories can be treated as first-class citizen and installed directly without convoluted binary packaging system (that still exists in the background, but only as cache to speed up build times). Nix also makes it very easy to upgrade, downgrade, side grade, patch, override dependencies or otherwise change packages, or even just keep multiple versions of the same software around. Something many other distributions still struggle with or make completely impossible with the distributions own tools. Even the act of installing software in Nix becomes somewhat unnecessary, as you can just run software straight from the Git repository.
And best of all, it's all based on a very simple and transparent packaging system, if you ever used GNU stow, kind of like that, it's all held together with a bunch of symlinks and some environment variables. No contains, no ostree, none of those ugly workarounds, just plain old Unix stuff that you can find
and grep
through as much as you like.
Simply put, NixOS puts the joy back in Linux, while other distributions like Ubuntu try to actively trash their reputation with a proprietary App store and others like Debian just stagnate around and are still stuck with the same old packing system that was state of the art 25 years ago and hasn't improve much at all since than. NixOS just provides a dramatically cleaner and simpler approach that also happens to be vastly more powerful.
Another cool thing, if you don't wanna switch distributions just yet and reinstall the full NixOS, you can just use the Nix package manager itself on whatever distribution you are already using.
[1] There is also GNU Guix, which is basically a reimplementation of Nix with Guile/Scheme
Here's the straightforward version of why I use it:
This very much. I used to have lots of unchecked config and state files everywhere on Arch. Now everything is checked in and wiped on boot so if something breaks after a reboot i know what broke.
Like how the opengl rendering did due to nixpkgs version differences
NixOS is a fully declarative and reproducable system.
What this means is that you can create a single configuration.nix
, which includes all of your applications, settings, aliases, environment variables, user account + groups, etc., and copy that over to another NixOS machine (including different architectures) and run nixos-rebuild boot
to completely reproduce the system on that other machine.
The nix package manager is also really good at telling you if the configuration will break anything, where, and how, and refuses to apply until the issue is fixed.
Also every time you use nixos-rebuild
, it creates a new generation of your NixOS install meaning if something ends up breaking, you can reboot into the old system.
So for example, I can theoretically have the exact same configuration across my desktop, laptop, phone, server, etc., minus the automatically generated hardware-configuration.nix
, which is specific to the hardware.
Also Nix supports package overlays, which means that you can modify an existing package while the maintainer still keeps it up to date.
Oh boy my two cents time!
I love the concept of NixOS. A fully declarative , reproduceable system from a single config repo! Sounds theoretically like it would be my kind of thing.
Sure, theoretically, I could have a fully reproduceable system. The time spent declaring that fully reproduceable system though... I remember the first time I was trying to get my usual disk setup of, a luks encrypted btrfs partition with multi-factor enabled decryption/authentication.
On a normal install it would take like a day at worse to install your distro. My first attempt with NixOS took me almost 4 days of screwing around in configs. 2 of those days were probably cumulatively spent waiting for the config option list of the nixos manual to search for text. And the number of redundant config options which all do the same thing! Or, are supposed to all do the same thing but in actuality, only one of them does the thing they are supposed to.
I really want to love NixOS but it always ends up feeling like an exercise in my patience and time to do even the simplest of things. As such I find myself asking the question of, am I going to spend so much time reinstalling my distro that it's ever worth this initial investment?
Anyways, rant over. I actually have been debating switching back over for another try again myself I just have some very frustrating memories of my first attempts with the distro.
Interesting, my first install of NixOS was done in a few hours and included a feature that I had not used in my previous Arch install, namely secure boot. It proved to be no issue whatsoever.
I do agree though that you're looking of lost without search.nixos.org, and documentation is lacking. E.g. did you know that enabling Plasma sets your main font to Noto, regardless if you're actually using Plasma or just have it as an option in your display manager? Or when to enable a program or service rather than adding it to your system packages? Or that if you install plain obs and some plugins, the plugins won't actually work?
I do understand why this is the way it is and I do think it's the better approach. But it's not perfect.
On the other hand, my system works very well in daily usage.
I switched around one and a half years ago. I must say, there are some hurdles to using NixOS. Mainly I dislike that it always takes around 20 times the effort to start and project. You make up for the initial time investment, because you end up with a far more stable setup, but still it does take some willpower to get things started.
I used NixOS for a couple of years. My experience is like this:
Note that there's both the rolling unstable channel and a bi-annual stable release channel.
Important to note that NixOS has both a rolling release and point release version.
The configuration stuff seems great. I guess it reduce the struggle of porting a full config from one pc to another right ?
You can even define configurations for different systems/hosts/users from a single place. I'ev atomized my config and I can reuse lots of parts for my different machines. Also my user config is nearly identical (except hardware specific things).
Yes absolutely. It is really great. It is also a source of frustration, e.g., missing configuration options, non-obvious options and so on. Overall it works well.
Are you still using it and happy with it? I've been increasingly using single purpose dev VMs in a server, and a declarative configuration system would make the process of spinning them up faster and more robust. My current shell script system is clunky, and I've been looking at Ansible.
Not using it anymore. Although I'm thinking about going back to it. The NixOS learning curve is a bit more steep than most other distros.
everyone
Now that's what I'd call a stretch...
Indeed, why would I switch, already have been running NixOS for 10+ years.
I'll edit. That was clearly a stretch
It's in no way "everyone", just a vocal minority.
I use Arch NixOS BTW.
I didn't get it either, but this video does a pretty good job explaining why it's different: https://www.youtube.com/watch?v=DMQWirkx5EY
SYMLINKS
SYMLINKS EVERYWHERE
(also 6000 packages intalled on my system for some reason lol)
Well, Nix has a very liberal definition of a "package". Your web browser, its wrapper script, a service file, a config file; those are all technically "packages" (or "derivation" as Nix calls them).
Doesn't it have a garbage collector like guix does (guix gc
), which cleans up everything in the store that isn't needed anymore?
nix-collect-garbage
I configured it to run every 7 days.
I keep seeing trends with Linux distribution like teenager looking for new fashion.
I think it’s mostly the very young Linux user who hope from one distribution to the another over and over whereas many just stick with what they got : Ubuntu, Debian, mint, maybe fedora.
NixOS is certainly interesting tho.
I daily drive GNU Guix instead, and I would strongly recommend any emacs and/or lisp enthusiasts interested in the benefits of functional, reproducible, declarative, and hackable system management to give it a try!
Do you run the gnu guix distro or just use the package manager? Because iirc it uses only free software, even for drivers. So I imagine it is not that easy to find compatible hardware.
I run the complete system. It's true that the standard iso comes with the linux-libre kernel and the standard channel (think repo) contains only free software. However there is the nonguix channel which comes with the full linux kernel, and all the proprietary drivers you could ask for.
Nonguix offer an iso with the full kernel too in case you have a proprietary wifi card and don't have ethernet for the initial setup. The nonguix README I think is pretty clear, but Systemcrafters also made an excellent guide for doing this.
My wifi card unfortunately requires proprietary drivers and I have personally never had an issue with guix + nonguix for all my software needs, proprietary and otherwise.
Hope that helps profligate!
I will switch as soon as I can get proprietary Nvidia drivers to work on my laptop.
That is the main reason I can't use my laptop with linux. It has a 3060 in it. I work as a dev and need to use 2-3 external displays with my laptop. The driver combined with x or wayland is atrocious, I tried 20 distros and I can't get it to work. The saddest thing is that none of the tech is exotic in any way. It's just HDMIs and AOC 24 inch monitors...
I've been using it for over a year and love it. A config file for your entire system, and built in rollbacks anytime something goes wrong. One language to configure everything, although in practice that doesn't always work. But I love it.
Some others have started why it works, here is some how. Nixos completely disregards the fhs. Packages don't install to anywhere standard, every package and configuration change gets it's on directory in /nix/store but through smart use of tracking everything there, it symlinks all those files to proper places and sets up the environment for them to know where libraries are.
This is then also why you don't need sudo privileges to install things. Your profile has an environment that is aware of your users packages and configurations, the system itself isn't effected because everything is symlinked.
Then because every update means new directories in /nix/store you can role back to your last configuration because plasma broke something or whatever.
However, it's a LOT to learn. Best place I know of is https://piped.video/watch?v=AGVXJ-TIv3Y&t=0
This guy did a good job for me. Hope this helps!
It's insanely stable but you have to have a lot of linux/programming knowledge to do even the simplest things like installing/updating your software or making little tweaks. I played with it for hours the other day and I'm just too dumb to figure it out lol I think it's just a super stable highly customizable distro for power users and a lot of people like that. If you can get over the learning curve it's a pretty powerful and unique os
It's kind of funny because I'd put NixOS on a complete newbies computer for sure, and recommend it to an expert... But I'm less sure if I'd tell a random mid-intermediate Linux user to switch.
Like if Grandma wants Linux on their computer to do some internet browsing for some reason... I'd absolutely put NixOS on it because it's easy to manage the system for them... But somebody who is a little familiar with Linux already might be more confused about the differences. It's kind of the ultimate beginner distro and the ultimate power-user distro, but a bit awkward between those extremes, haha.
It's true that it can be a powerful distro but I've also heard from some users that the advanced-level documentation is lacking and only limited to forums and source code. I think maybe if the documentation was more thorough I would try nixos.
you have to have a lot of linux/programming knowledge to do even the simplest things like installing/updating your software
So, pretty much like any other distro
Most mainstream distro's can do all of that without a CLI.
I have been using for years on servers. My lemmy instance is hosted on it.
Although for desktop I had too many issues back in 2019 so I ended up back to Arch Linux and then EndeavourOS
Would be fun to try again to use it on desktop
I think I will give it a try on a server first, I don’t have a playbook or script for a reproducible set up (yet), so I may as well use Nix to see if it’s worth the hype
I'm using Void Linux and see no reason to move over to NixOS. The concept seems cool though.
The nice thing about nix and guix is that they're package managers, and so you get most of the benefits even if you're using a different OS.
I'm currently transitioning from Doom Emacs to my own config that's using guix. So far I've got a single manifest that contains all of the Emacs and Linux packages that are needed to run the config.
The guix part is really simple, but it allows me to reproduce my config on any Linux distro by cloning a repo and running a guix one liner. A different one liner can run it in a containerised environment. Also, I can roll back to any previous time I've updated something through that manifest, or pin a specific version of a package.
And that's just scratching the surface of what you can do.
Glancing over the website, I thought it's an immutable OS, like Fedora Silverblue. I could imagine that it might be cool to use with Ansible and stuff. But for an average user? I can't really see the advantages in respect to the work you have to put in.
It is an immutable distro, altough it isn't image-based like Fedora's rpm-ostree.
NixOS basically replaces Ansible because the Nix package manager achieves the same goals already (configuration, deployment, ...).
But I agree, the work necessary to put into this non-standard distro makes it hard to recommend for a casual user.
All I year about from the linux community is NixOS and btrfs, neither of which I have any interest in. It almost feels like someone with an agenda is promoting these two with how prevelant they are.
I like using btrfs with Arch because of the snapshots. If an update breaks something I can just boot into a snapshot from grub keep using my PC and solve the problem later. It's very useful... yes... very... you should try it... come... try btrfs... it's warm and cozy... INSTALL IT!
I have tried btrfs in the past and when it goes wrong you are utterly shafted. You can't even mount it as a read only file system, it will just lock you out entirely. And the support isn't great, I ended up finding something that had a disclaimer along the lines of "only run this if you really know what you're doing", but obviously I didn't as the documentation didn't tell me enough to know. So the only people who could possibly know are the developers of the file system themselves. Anyway, I was 2 days in to trying to recover my data by this point so I gave it a go, nothing to lose - it refused to do anything. Great.
So in summary I'm not going to try it again.
I don't get the hype. I'm staying with Arch, as Nix seems to be mainly for developers.
NixOS has benefits not just for developers, altough being familiar with programming is helpful.
For me the main benefit of NixOS is being able to keep multiple systems in sync. For that I have 3 config files, the first containing all general config and packages I want to have installed. The other two are for my laptop and pc respectively, which allows me to make system-specific changes. E.g. tlp is only enabled and configured on my laptop.
And NixOS isn't just rolling release, it also has bi-annual stable releases, which is great for servers.
Rollbacks are also awesome, altough I used btrfs snapshots a few years back with Arch for a similar result. With a bit of setup they are bootable from grub.
Because it’s the latest Cool Nerd Thing™ like Arch before it, and Gentoo before that. Most of the people raving about it probably don’t have much use for its features.
The features themselves are very useful for basically any user. Whether they are worth the non-standardness and issues that come with it is another question.
Solution without a problem. A cool solution but yeah.
For those who like a video format, I found this introduction quite informative.
Thanks for this, it was definitely a nice overview. Not the first time I'd heard of NixOS, but I do seem to be seeing more frequent and more substantial discussions of it.
What I'm getting from all this, is that it looks to be a great way to set up reproducible desktop environments. And servers too, I suppose.
What I'm not getting from this: a compelling reason to switch from established players like RHEL and Ubuntu in combination with cloud-init and Terraform and the likes of Chef/Puppet/Ansible/Salt to spin up a cluster in the cloud, reconfigure, tear down, etc.
In case anyone is misreading me: this is not a dig at NixOS. It definitely looks interesting. Like, to the point that I'll at least spin up a VM on my Manjaro laptop and see whether I should perhaps consider wiping and reinstalling with NixOS. The "configuration through code" is extremely appealing here.
My concern here is corporate inertia. And before anyone gets gets ready to launch a diatribe about how corporations don't decide what the best tech is, I will agree with you. I've been around a while, and excitedly watched as Unix ramped up and displaced platforms like VAX/VMS and AOS/VS, using smaller and faster hardware. Then along came Linux and the battle for which distros would dominate.
As for configuration through code, I've been keeping a keen eye on things (tinkering when it's been possible to do so) since the days of cfengine and Jumpstart. I used to share this site with anyone that would listen to me; it's dated now, but the underlying principles are (were?) solid: http://infrastructures.org/
So for now, I think I'll have to limit my professional NixOS usage to tinkering and potentially useful side projects. For personal usage? Yeah, it might become my daily driver, but I need to find the time to tinker.
I will say that I'm presently involved in an effort to test something out that has my company's product available using rpm-tree. Not my decision, this is all being driven by a customer that has a lot of clout; they really, really want to use rpm-tree. It's proven to be a bit onerous at times.
What this NixOS discussion has managed to do for me is to have me wondering whether a NixOS approach would have worked out better; my sense is that yeah, maybe it would have. But my feelings here might simply be the result of "woo, shiny new object", which has definitely colored my opinions of things in my career of 35 years. Something that I've had to restrain my excitement over, pending corporate sanity checks.
Having the option to have multiple versions of a dependency without needing to have duplicates of the same version alá flatpak seems like it should've been a no-brainer on any linux distro.
With that said I'm very comfortable with my current system, so definitely not until I get majorly fucked by my life-choices
Definitely sounds like a competent player in comparison to most distros though.
And I feel like the terminal isn't as big a barrier as everyone makes it out to be (part of why I say that is because I think the entire concept of "beginner friendly distros" only makes the terminal seem more impenetrable through that wording)
All-in-one config is definitely something I would've hoped Arch had as well, and as a bonus I would love a system that kept all things related to the user in /home (I'm not completely sure Nix does but I may as well throw that in) (homed does not do that as it still has entities outside of /home that you better back up, in fact you'll risk being locked out of your user if you don't)
as a bonus I would love a system that kept all things related to the user in /home
I've been looking at it after numerous times I update Fedora only to have some tool break that I use daily. Then I spend a chunk of the day getting Virtualbox working again so I can do my job (write code for websites).
I haven't made the jump, but it looks very interesting.
I've made the jump twice, and jumped back twice.
Conda and any other reproducible computing library that relies on LHS Linux filesystem just doesn't work on it (okay it does, but more as an obstacle)
I'm okay with having nix the package manager on my default arch system though, since it is incredibly useful for cross compiling, and it let's me modify my system however I want.
Have you tried putting it into a buildFHSUserEnv?
I also often put the "dirty" packaged AI/python stuff (which is unfortunately quite a lot) into Dockerfiles if I don't want to package it cleanly with Nix.
What about Nix's financial issues? Have they been resolved yet?
To get it out of the way first: There are no financial issues. There are more than enough funds to continue operations as they are for a sufficiently long time.
What is actually happening is that a long time sponsor has indicated that they (understandably) no longer want to foot the huge bill of hosting the entire archive of binary caches ($9000/mo). Finding a more sustainable setup is what the community is currently concerned with.
There is no risk of operations shutting down any time soon, the NixOS foundation has funds set aside to continue even this unsustainable setup for at least a year. We just want to be more efficient with our and others resources going forwards.
That's what all this you might have heard of is about.
Btw, even if the binary cache were to go poof, we don't technically need it. NixOS is a source-based distro like Gentoo and source hosting is not a concern. The binary cache is immensely helpful though which is why we'd obviously prefer to keep it.
I think AWS Gave them 12 months of free credit to host cache
I'm really not sure of where this would be anymore usefull than a simple bash script to install all packages you need since it doesn't do configs and that rollbacks are supported by some filesystems already. Also Having version specific dependencies is already a thing for flatpacks and such
A simple bash script is not reproducible or deterministic. Also a filesystem rollback is not the same as NixOS's generation based rollback.
Also, NixOS doesn't just install packages, all system configuration is done declaratively, which would be a very bad idea to do via a bash script.
I have to check a little harder on what it does since I saw in a vid that you still needed to add your own if statement to get it working I assumed a simple
pacman -Qk xorg-xrtrop 2> /dev/null && sudo pacman --noconfirm -S package1 package2 package3 || echo 'I aint got no x, idiot'
would do the job as well
There is a world of difference between a bash script and something like NixOS. The most important difference is that with NixOS something that you don't specify won't be there. Whereas a bash script (or other config management tools like Puppet, Chef or Ansible) only mutate things listed.
So it is very easy to write a script like:
undefined
ensure_installed python3 write_file /etc/foo.cfg 'thing = 7' chgrp users /mnt/backups
But if you remove ensure_installed python3
it will stay installed. You can try to be very careful and always add ensure_not_installed python3
but this is both error prone and dead code as soon as you run it. I used to have a script like this and I used each of configuration management tools mentioned above and always ran into these issues. The exact error flow would be something like this:
ensure_installed X
but it works anyways because X is still installed from step 1. Now you have a non-reproducible config because if you try to re-install or setup service B on a new machine it won't work because X isn't present. This may sound like a niche problem but I ran into it almost every time I tried to bring up a new machine using my config.
It is still possible to do this in NixOS as it isn't completely reproducible (you can have mutable state) but in general it is much harder because any configuration that isn't specified doesn't exist. As soon as you remove package X or service Y from your config it is removed from your system. I've been using NixOS for 8 years now and this problem is mostly gone. It is definitely more reproducible than bash scripts and it has a tangible effect on my workflow.
I wrote a blog post about it a long time ago but the core is still relevant: https://kevincox.ca/2015/12/21/service-management-with-nixos/.
Part of the purpose of NixOS is providing a means to build a reproducible environment that's easy to configure, migrate, and rollout. You can absolutely handle configuration of many different programs using either flakes or the native modules provided by nix. You can customize your entire system from firewall entries, to users and their shells, to the kernel itself and the kernel modules you'd want it to load, all in a single file or multiple files. If you want to try doing all those things in bash scripts, good luck and please share your experiences but don't expect it to be as easy as the Nix ecosystem.
so it does handle more than just conditional packages like the other zealots make it sound like
They don’t know about Debian stable.
I don’t know NixOS. My Linux machine runs Pop_OS and Manjaro.
What are the pros and cons of NixOS ?
They're not but nixos users are REALLY loud, as in, they can't spend a single day without talking about it.
New Arch. Both still worse than Silverblue.
Agreed, Silverblue is great. I would love a declarative system, but Nix just doesn't make it easy with its sprawling documentation and mix of new and old parts. I was trying to follow a guide for Home Manager, but couldn't use it because they were using flakes, I was still on the "old" configuration.nix style.
You can't make all things declarative either. If I can only have things 50% declarative, it kinda defeats the point.
I also still tried to use flatpaks since nix doesn't have sandboxing and is slower on updates, but its font configuration was broken.
Nix overall feels like it's requires a lot of workarounds, moreso than Silverblue.
But hey, at least if I ever want to try it out again, I just need to copy in my configuration.nix and make things work from there.
Yup, I did the same thing. I really wanted to make it work but I think it just needs some time to mature. Once it has some clean documentation and polishing it'll be really cool.
I really liked how NixOS has a hardware config repo. I have a Framework, used the config, and everything just worked. I mean it usually does on other distros too but it's nice to know that if there's a config it'll be guaranteed to work.
I'm currently really enjoying kinoite. I think it also has some documentation issues but it's also not as radically different from your average distro as NixOS..