(2025-09-01) A month with NixOS
-------------------------------
Yeah, it's been about a month already since I'd ditched Arch (namely CachyOS)
in favor of NixOS on my main machine. And here are my impressions about this
distro and personal thoughts about its possible future use.

First, I realized that one really needs to give up on old practices in order
to fully embrace the power of Nix. Instead of relying on profiles and
flakes, just let the /etc/nixos/configuration.nix file do its job. This file
allows you to configure literally everything that's not configured via the
home directory dotfiles/dotdirs, including but absolutely not limited to the
package list, hardware configuration and dedicated configuration sections
for some popular services. These include a lot, e.g. Docker, Wireguard,
OpenVPN, Tor, ZeroTier One, GPG agent and even Ollama, just to name a few.
After making the changes, it's just a matter of running sudo nixos-rebuild
switch to apply them, optionally adding --upgrade to upgrade any possible
packages that have a more recent version.

Second, the same file provides you the access to the NixOS overlays mechanism
that allow you to change individual package configuration or even pin their
versions to some values not readily packaged yet. For instance, this is how
I pin the llama.cpp version and enable AMD ROCm support for it:

# package config overrides
nixpkgs.overlays = [
 (final: prev: {
   llama-cpp = prev.llama-cpp.override {
     cudaSupport = false;
     rocmSupport = true;
   };
 })
 # TODO temporary overrides
 (final: prev: {
   llama-cpp = prev.llama-cpp.overrideAttrs {
     version = "6332";
     src = pkgs.fetchFromGitHub {
       owner = "ggml-org";
       repo = "llama.cpp";
       tag = "b6332";
       hash = "sha256-DwJbFdwxhrx616IERxeyN9GbhWralv3IpkLRTbiKe1Y=";
       leaveDotGit = true;
       postFetch = ''
         git -C "$out" rev-parse --short HEAD > $out/COMMIT
         find "$out" -name .git -print0 | xargs -0 rm -rf
       '';
     };
   };
 })
];

Whenever I'll need to update the version, I'll alter the "version" and "tag"
fields accordingly, and also set the "hash" field to an empty string. The
next sudo nixos-rebuild switch run will error out by pointing me to a
correct hash value, and then I'll put it in there and rerun the command to
build and install the new llama.cpp version.

Third, there definitely is a way of handling third-party prebuilt Linux
binaries. Most of the time, they expect to be run in an FHS environment,
which NixOS by itself is not. That's why you must create FHS-compatible
environments with the buildFHSEnv method in order to run such binaries. For
example, here's the shell.nix file I prepared for the official RVGL (Re-Volt
source port) game package for Linux:

{ pkgs ? import <nixpkgs> {} }:

(pkgs.buildFHSEnv {
 name = "rvgl-env";
 targetPkgs = pkgs: (with pkgs; [
   mesa
   alsa-lib
   libGL
   libGLU
   openal
   flac
   SDL2
   SDL2_image
   fluidsynth
   libunistring
   libvorbis
 ]);
 runScript = "./rvgl";
}).env

Then I just run nix-shell from the game directory and the game starts.

Fourth, I found out that frequent configuration updates create a lot of
unnecessary artifacts and also a lot of generation entries in the boot menu.
There is a documented way to fight this: once you've rebooted into a new
configuration and everything works correctly, you can just run sudo
nix-collect-garbage -d to get rid of the artifacts and then sudo
nixos-rebuild switch to get rid of invalid boot menu entries.

Finally, I found out that the "unstable" NixOS channel doesn't really live up
to its name and everything actually is pretty stable here. Yes, I switched
to this channel almost right away because I found the package versions in
the "stable" channel quite outdated, especially after living with Arch for
so long. So far, nothing broke and I hope nothing will. If anything, that's
the greatest virtue of NixOS: no dependency conflicts by design. If I were
them, I'd rename the "unstable" channel to "rolling" because that looks more
like it, giving the Arch experience without having to worry about dependency
hell.

As such, my overall impression on NixOS is: you invest some time in the
beginning into learning configuration.nix and what you can do with it, and
then everything... just works. And keeps working. I think that if I ever
need to migrate to another VPS, my next provider will be the one that allows
installing NixOS. And on the desktop... I think it's definitely a keeper on
mine, at least until anything better comes up.

By the way, Linux has been desktop-ready since long ago. You aren't.

--- Luxferre ---