nix fixes this

nix fixes this

innocentzero

2026-06-08

#nixos #package_managers | Status: Ongoing

A brief on how nix fixes the many problems I had described in pacman in my previous post, often in rather unconventional ways thanks to its unique model.

Is this package required transitively by other packages?

In nix, each package is generated and stored as a derivation, with the extension .drv. Think of it as the bytecode for nixOS (although this framing is really crude).

While pacman only allows for a simple direct checks on whether a package is referred to by other packages or not directly, nix lets you do it recursively as well. It tracks the input derivations (and other sources) in the derivation itself and can even form a complete dot graph for you. Pretty neat.

Although, if I'm being honest, this is sort of not so useful in the context of nix usage, as we'll see ahead.

Can I just remove a derivation/demote it to a dependency?

Nix does not have it as a concept. Instead, what it has is the GC lang runtime feature of roots and their transitive closures. It has a fixed method to find explicit roots. It will look at some standard places: derivations installed via nix profile install/nix-env --install, specified in the configuration, and manual GC roots.

This is more or less akin to how a garbage collector would walk the stack, the thread-local roots, and the global roots in the program and create their transitive dependencies.

Then how do I mark a root as a dependency?

You don't need to. nix-collect-garbage will automatically deal with that and find out all the unused store paths for you.

Can I remove arbitrary derivations?

You can. Nix lets you do that, but really, nix-collect-garbage is what you should be looking for, unless you're someone who wants to save time and knows what he's doing wrt. a derivation (I'd reckon very few do).

Blah blah blah

So yeah, you get the point. Nix has really good features, and they work rather well on most systems. I am slowly creating a config on nix to use, and it's panning out beautifully well. It has also given me an opportunity to edit my neovim config (although that's still a sore topic for me, as are evident in my TODOs).

I was going to write a complete blog post and detail every feature, but I really want to move on from this stale blog and write more important things. I have a pending update for supac (spoiler alert: it's bad). More importantly, I have moved on to write Java at my work, so there's that as well. Less rust ig :)

So what does nix NOT fix

Packaging. It's still slightly hard. If you have some really complex application, it'll kind of be a nightmare to package that for nix.

Apart from that, evaluation. It's... single threaded. So it's really slow. It can take a couple of seconds for eval, even though my config is rather lean so far. Even simple dotfile changes through home manager can take upwards of 10 seconds. I guess it's fine, but it surely can get annoying.

Having said that, there's still a lot of things that are really good in nixOS, and I really look forward to using all of them.