Ok, I Guess I'm a NixOS User Now
NixOS. That's a word that means nothing to most people, but is the source of a deeply opinionated battle for those who know what it means. Some love it, others despise it.
And as of 24 hours ago (at the time of writing), I am now using it.
Ok but what is it
NixOS is a Linux distribution which is configured via code.
On a traditional Linux distro, installing packages looks like this:
pacman -S my-package
However, if you're also a programmer, you may be used to a completely different method of package management:
[dependencies]
my-package = "1.0"
This method of package management is called declarative package management, as it lets you tell the computer exactly what packages to download, including features and versions. This is highly useful, especially in programming, as it makes your builds reproducible - anyone downloading your code will automatically download the exact same dependencies that you used, and there aren't any worries of those dependencies changing or removing features that could break your code.
NixOS aims to bring declarative package management to your operating system.
However, unlike most programming languages, NixOS doesn't use TOML, or JSON, or even YAML. Instead, it uses a DSL called Nix, which was what the operating system itself was named after. Nix isn't just a configuration language - it's a full-blown functional programming language, that just happens to look and feel a whole lot like JSON.
As an example of what Nix code looks like, here is how my user account is defined in my configuration.nix file:
# Defining a user account.
users.users.junideergirl = {
isNormalUser = true;
description = "JuniDeerGirl";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
prismlauncher
vesktop
];
};
The advantage of this is simple: if I need to reinstall, or want to move to a different computer, I don't need to spend hours ensuring my setup is the same as it was previously. I can just copy my configuration.nix file, run sudo nixos-rebuild switch, and suddenly have a setup identical to my previous one.
Why I switched
As with all my adventures in Linux, it started with me wiping my hard drive.
I have been interested in switching to NixOS for quite awhile now, mostly due to this great video by No Boilerplate. For reasons I don't quite remember, I decided to try installing it on a spare hard drive, to see what it was like. I messed with it for a bit, then tried to switch back to my main installation. And, lo and behold, GRUB was broken. Certainly not something you want to see when you're mentally exhausted and just want to play Stardew Valley.
So I took the nuclear option and put NixOS on my main drive too.
What its like
After expecting NixOS to be a nightmare, I've been pleasantly surprised by it! Once you get used to Nix, configuration isn't bad, and setting up Nvidia was far easier than its been on most distros (just creating a section in my configuration.nix).
Previously, my main distro was Bazzite OS, though I primarily worked through an Arch Linux Distrobox setup. I liked this because it gave me the stability of an immutable distro, and the up-to-date packages of the AUR. This experience has definitely helped me get used to NixOS - I'm quite familiar with atomic distros by now - and means that moving to NixOS was a far smaller leap than I expect it will be for people who have only ever used a traditional Linux setup. I also am now running my "essential packages" (VSCodium, Wezterm, Nushell) natively rather than through distrobox, which feels a lot better and makes my system feel less cobbled-together.
One thing I did that diehard Nix fans probably won't like is installing Flathub, and downloading flatpaks graphically via Bazaar. While flatpak goes against the core Nix philosophy of reproducibility through configuration.nix, the discovery and convenience of flatpak is unmatched - if I need some app, I can just search for it and download it, without editing my configuration.nix and rebuilding my entire system. I do highly recommend others do this too, especially if they're new to NixOS, as I think this will make the switch far easier.
Do I recommend NixOS?
Given NixOS's awesome community, massive package repository, and reproducible, atomic nature, I can only say one thing:
No.
In all seriousness, NixOS is a great option, IF you're already an advanced Linux user and are interested in its featureset or simply want to experience something different. However, I would also recommend trying it out in a VM or on a second hard drive before you start daily-driving it. And for beginner users, or those who want a system that simply works with no fuss, I would instead recommend Bazzite OS, what I was using before I switched.
That's all for now! I will create more blog posts about NixOS if I discover anything I want to talk about.