NixOS as a whole, just Nix, or nothing as a current Arch user?

Hi!

I’m currently on Arch, but the declarative nature of NixOS seems very appealing. However, the fact that it is an additional layer of abstraction, whose knowledge can hardly be applied to any other distro, is making me wonder if I’d actually enjoy that long-term, or if it would simply cause new, worse problems when things do end up breaking.

I’ve been thinking of mixing Nix into my current system to just try that out, but if I combine Nix with Pacman and the AUR I feel like that’d defeat the point of Nix, right?

With all of you having way more experience with Nix(OS) and likely having used other distros before, what would the benefits and downsides of either approach be?

I haven’t used Arch but for what it’s worth, I currently use Nix on a NixOS machine, a macOS machine, and three Ubuntu machines. It’s excellent because it means anytime I boot up any machine I can just get my latest config with two commands:

git pull
home-manager switch

Ubuntu and Arch do also have their own package managers, but that doesn’t really negate the benefits of Nix, in my view. And then of course there’s also direnv which combines excellently with Nix, especially if you develop software.

1 Like

I disagree, it’s the same knowledge needed to configure the same software. You’re just adding an abstraction layer to write said config (which you could use GitHub - numtide/system-manager: Manage system config using nix on any distro for on other distros).

But search previous threads, this gets asked monthly, etc.

whose knowledge can hardly be applied to any other distro

this is not accurate, nix just wraps standard linux tools, the moment you start writing your own derivations you need to glue the declarative config into the actual imperative shell commands. nix does not hide the complexity, just abstracts it on a higher level which means you need to be pro-efficient in both linux and nix worlds.

1 Like

I’ve been thinking of mixing Nix into my current system to just try that out, but if I combine Nix with Pacman and the AUR I feel like that’d defeat the point of Nix, right?

You can start with just using nixpkgs in specific projects. That’s how I started: I just started making my newer dev projects Nix-based using Flakes. No need to go all in (just yet). This gradual on-ramp is IMO underrated :wink:.

It’s helpful to think about what you want to achieve. You can try to get familiar with the nix language itself at first, then the command line tools, then flakes. Mess around with some things, try to define the dependencies of any projects you’re doing entirely in Nix.

Then one day you’ll realize you want to use it more ~ by then, you should be in a better position to judge whether the abstraction that NixOS provides is worth it.

3 Likes

The extra layer of abstraction is the primary reason we use NixOS at all, since it comes with so many of its own benefits. Perfect reproducibility, easy deployment, everything in one place, atomic OS state, and so much more. Speaking as someone who came from Arch Linux and had to deal with many of the problems associated with it, I’m much happier on NixOS, even if the initial journey was confusing. Having a system configuration that I can easily redeploy, rollback, and modify is incredible. My system has never been so stable, especially not on Arch :sweat_smile:

In my opinion, the best use of Nix on other distros is as a tool to write packages/development shell, not as a package manager. Many of the derivations on Nixpkgs, especially for system critical components like systemd, are patched to work for NixOS. That usually makes them unsuitable for other systems. I have a server which runs Ubuntu 22, and I primarily use it to create dev shells and write derivations for my packages. I find it to be the best for me, especially because I can then use those same derivations on my NixOS laptop with no modifications.

I’d encourage you to download Nix and try using it in this way as well. Getting familiar with the syntax and writing derivations is one of the biggest and most important things you’ll need to know if you actually want to use NixOS. Also, don’t get sucked into flakes too soon, it’s not as fancy as some online sources make it seem. Just learn at your own pace without getting sucked into random ecosystems, Nix is very rewarding.

I feel like I could probably write forever but since I’m on a mobile phone and my fingers aren’t quite built for this much typing, I’ll keep it short.

System stability is a major win, especially as a bleeding-edge distro. Other “stable” distros like Ubuntu keep their stability by updating things ridiculously slow. It’s a pacing that I kind of find unacceptable in a world where bleeding-edge software is usually so easily accessible on other OS, like Windows or MacOS. On the other hand, bleeding-edge distros like Arch Linux suffer from the constant need to babysit the OS. I always hated how the occasional major update would break something, or how not updating for a few weeks made any future updates increasingly more dangerous to do. While I had gotten enough experience to reliably fix my system, at least for the former, I didn’t like having to do it. I needed my laptop to help me do my work, not to be another unnecessary hassle.

Another win is reproducibility. No other distro has the kind of facilities to reproduce itself on a clean install like NixOS. For every other distro you had to use some third-party app to store your files. Deciding which app to use and then subsequently remembering to track down your files was also a big hassle. I didn’t like having to configure my mirrors, or /etc/fstab, or pacman, or anything else on a clean install. It added a new imperative step that I would risk forgetting. I always dreaded a clean install because of how much stuff I’d have to redeploy or reconfigure. The first time I broke my NixOS install (purely my fault not NixOS), I also worried about the reinstallation process, but seeing how flawlessly my system redeployed itself, with every single thing completely intact made me feel amazing. It felt like I didn’t even reinstall, that’s how seamless it was. I had to do literally nothing to get my system back after the initial nixos-install.

Nix is a bit hard to learn, that’s probably the main downside. It does things completely different, and especially in the case of NixOS, things get weird. You can’t get used to things like /usr/bin existing, FHS is a no go here. Lots of tooling designed around FHS assumptions do not seamlessly work without modification on NixOS. The reward is everything I said above and more, but the cost can be initially daunting. That’s why I think it’s a good idea for you to experiment with Nix on your main system before jumping to NixOS. Learning Nix greatly helps the transition, especially if you understand how Nix works at its core, and the design philosophy around derivations and Nix as a whole.

1 Like

Nix as a secondary package manager, without home-manager.

(Configs, separately, in a VCS with symlinks between the repository and where the programs expect them)

Then you configure things the same way as everywhere, but side step most of the «I need to upgrade these two things at once due to a dependency» pain, can easily define separate (reproducible) environments without the notion of package conflicts between them, etc.