Why You Should Use NixOS

Associated Youtube Video: https://youtu.be/6WLaNIlDW0M (please don’t watch this, the quality is terrible, I will redo this at some point tho)

Associated Odysee Video: https://odysee.com/@LibrePhoenix:8/why-you-should-use-nixos:a (no, seriously, don’t watch the video, I beg you)

Next Tutorial: Intro Flake Config Setup for New NixOS Users

So, what is NixOS?

First off, a few defintions:

  • Nix - A functional programming language used by NixOS
  • Nix Package Manager - A package manager that focuses on reproducibility
    • Ensures the inputs to the environment are expected/known
    • Is declarative* rather than imperative*
  • NixOS - The Linux operating system, but managed with the Nix Package Manager

*Declarative means that you setup the configuration of the computer with a configuration file or set of configuration files. If anything is added to the configuration file(s), it will be added to the system. If anything gets removed from the configuration files, it will be removed from the system. By saving the configuration file(s), it is easy to get the system state back.

*Imperative means that that you setup the configuration of the computer through a series of steps. This series of steps may include installing your necessary packages one-by-one, modifying settings in a settings manager, and/or editing system files in /etc by hand.

NixOS distinguishes itself from other distros from its package manager: The Nix Package Manager. Since NixOS manages itself with configuration file(s), it is a perfect distro for nerds, tinkerers, and people that like to configure their setup to be just the way they like it!

What’s the catch?

NixOS is not perfect. Here are some of the downsides:

  • Nix is a bit weird and esoteric (it’s also a functional programming langauge, which makes it extra weird). Unless you’ve already mastered another functional programming language, like Haskell, the structure and methodologies of Nix won’t make sense for a while.
  • The documentation isn’t helpful for new users. The documentation isn’t bad, it’s just that it is as esoteric as the Nix language itself. You won’t find inexhaustive amounts of practical information like you would in the Arch Wiki. Instead, the documentation is focused on gaining a deeper understanding of the Nix langauge, which is cool, but may not be the most beginner-friendly.
  • nixpkgs (kind of like the Nix package repository) has over 80,000 packages (more than the AUR), but if the package you want isn’t in there, good luck trying to get it to work! In order for NixOS to work, it doesn’t utilize the standard root directory structure (/etc, /bin, /usr, etc..). Instead, almost everything happens in the Nix Store (/nix/store). As such, many programs will just not work since they are hardcoded to these paths. Packages in nixpkgs are patched (so they actually work), but if you want to install something else natively, you better be ready to patch the source code yourself!

Okay, this sucks. What do I get out of this?

Enlightenment.

Plus a few other, more practical things, mainly:

  • You can make your system configuration extremely modular. Since your configuration is managed by config files, you can separate the configuration into modules, and then swap parts in and out very quickly as needed.
  • NixOS is extremely good at managing multiple machines. If you need to install the same environment to multiple machines, just transfer your configuration files to the other machines and rebuild those systems using the configuration files. You can do this with just 2 machines, or hundreds of machines, if necessary.
    • For developers: Nix can also manage build environments and integrate with tools like direnv. The build environment is stored in a (you guessed it!) configuration file, which can be included in the project. This ensures that everyone has the exact same versions of dependencies and build tools, allowing everyone to have a reproducible build environment.
  • Since the system state of NixOS is managed by configuration file(s), it can be easy to recover from a disaster scenario (hard drive dies, laptop falls in a lake, house burns down with computer in it, etc…). This is even more the case if you have a highly-customized setup. Using other distros, to get back your system (or a new system) to the same state, you would either need a full system backup, or you would need to remember all of the commands and tweaks you used to setup the system. Using NixOS, I feel peace of mind knowing that something could happen, and I don’t need to reconfigure the entire environment; I only need to restore my files from backups!

What do you think?

If this as piqued your interest in NixOS, give it a try! I recommend starting in a virtual machine and learning how it works before you install to bare metal.

If you want to see how I start configuring my NixOS systems, the next tutorial post is here: Intro Flake Config Setup for New NixOS Users

Have fun Nixing!

Donation Links

If you have found my work to be helpful, please consider donating via one of the following links. Thank you very much!