This is the follow-up of the article NixOS init
So, how does NixOS feel after a few days of usage?
The learning curve is a wall. Picture a deadly, cold wall loosing itself in the fog (picture it in your mind, leave Midjourney alone).
Passed the installation and minor-tweaking the default configuration, the following days are horrible, but let’s dive in the details of the journey before I forget them (it’s not like I could but still…).
The first days feel like the NixOS home page which greets your with a language you never saw, without syntax highlighting.
The first plan looked like this:
The language is pretty straight forward (didn’t use a functional programming language for a too long time, but Nix is not overly complex):
Except a few tricks I needed to look up while reading some configuration code, the rest is readable. I’m definitely not a Nix expert, just have the level to read basic Nix code.
I likely invested a bit too much time in the language learning for a kickstart but definitely not a waste of time. Just to try NixOS, probably a grasp on attribute sets is enough ;)
Consider this analogy: learning shell scripting to edit your .bashrc This is definitely not wrong but maybe consider postponing.
The manual is between really useful and a joke: probably exhaustive list of every available packages with scarce details.
But actually the packages configuration sources are readable.
It’s just about editing the config, what could possibly go wrong?
So, I had a rough idea how what is taking care of what, where are the clearly delimited boundaries. In theory…
One of the first question poping really fast while digging around: “Should I use Flakes?”
The main arguments for the flakes: “Everyone’s using flakes, use them!”… cool but try with arguments… and rabbit hole discovered!
Officially they’re instable, and their RFC is still on a branch which PR was declined, but indeed for new configuration you should use flakes.
Flakes:
Some background: I come from Debian which means “stability” to me. Yes it’s anoying that some packages are too old but I generally handle these ones without package manager (compiling from sources for intance, looking at you Emacs).
My flakes interpretation: Make the build reproducible, pinning every used package version in a flake.lock (which I .gitignored seeing this generated file fith this extension poping up btw…).
Oh btw, as you use flakes, use nix-command (still unsure why they always seem to come together and what other experimental stuff I should have a look at).
One of the next question is about nixos / nixpkg unstable. Both nixos-unstable and nixpkgs-unstable follow the master branch of the Nixpkgs repository, but if anyway everything’s pinned, if it works, it should be stable-ish right?
The most answers about picking any solution sound like “Hey, it’s your OS so it’s your call”
I wanted to make everything correctly, from the beginning (sounds good? Was likely a mistake).
This implies bringing up flakes, trying to understand modules, and use home-manager while having no idea of NixOS.
Which means: instead of pasting some stuff accumulated over years in ~/.config I thought I would very soon use home manager so denied this intermediate step.
This also implies: No editor config, no bash aliases (okay, cracking down and adding aliases manually from time to time to the current bash instance or just prefering ssh) but you get the idea.
So to summarize the first few days: It’s horrible! But let’s see after a few weeks.
So I learned the hard way to
Read the error messages, not using --show-trace without a good reason.
Use --dry-activate / --dry-build
It is much more user-friendly to read something like:
“would remove group ‘networkmanager’”
or
“would remove user my_only_user”
and pondering if a rebuild switch is still a good idea instead of wondering why the ssh connection dropped or why login directly or through ssh just doesn’t work anymore.
Actually, I have git hooks running nixos-rebuild with dry-build / dry-activate, just in case.
That said, a very good feature of NixOS is to forbid generating an OS without a user (I tested, yes root is still there).
File not found likely means “Hey, you forgot to git add”
“everything’s obvious, afterwards”.
According to me, enforcing a VCS is a good feature.
The sources of upstream packages are readable.
To be brutal, maybe more readable than the man page which just blindly list options for a package… which would be super cool… if you could easily install packages offline.
This is still a recurrent issue for me.
Some packages are still commented out because they need to be built, … on every rebuild switch which I don’t understand.
Why are not every or none package are built, why some are? This is still an open question.
I was debugging my i3 config, while being logged in and was happy that everything finally worked (forgot the modifier key…). The day after I could not log in: LightDM reported: “Failed to start session”
This happened multiple times to me (I know, I’m the culprit): on the list of errors where you start to consider testing if roll-backing works:
error: executing “git”: No such file or directory
Note that git not needed by nix-env, so just start an environment with git.
As a side effect, I’m rebooting even more than a Windows user (ok not that much but still a few times a day to make sure the config did not break).
… Everything I guess, but maybe urgently:
Having a look at the garbage collector: after a few weeks (85 builds), 141MB free over 1GB on /boot good to keep in mind…
nix-env nix-shell nix-daemon nix-your-grandmother
Out of curiosity: are python virtual environments or docker still a thing? I would have expect a sound “no” but the NixOS homepage has a section about “Minimal docker images”
As I’m thinking my configuration to work on multiple machines, cross-building would be interesting.
Find a way to search for a package using a cache (so in less than 30 seconds).
How to properly debug a configuration (of course not that I need this but…)
The vimjoyer - “Learn Nix” course - Videos on youtube about specific features
Some friends which shared / explained their configs to me.