this post was submitted on 12 Oct 2023
15 points (89.5% liked)
NixOS
1064 readers
1 users here now
NixOS is a Linux distribution built on top of the Nix package manager. Its declarative configuration allows reliable system upgrades via several official channels of stability and size.
This community discusses NixOS, Nix, and everything related.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The Nix / NixOS documentation is notoriously bad and that sentence is a prime example.
My advice, you can probably get on quicker with YouTube than with the official documentation. Or you can just muddle through like I did. Might take you longer though.
I'll take a shot at unpacking the functional part though: Imagine a system like a math equation, like "solve for x". The system is the result of that equation. You define a couple of constants, like "I want it to run KDE" and nix will try to fill in the variables, eg. to run KDE you need bash, python, Wayland, etc. Like in school, you can break this equation down further, eg. to solve for Wayland, you need wlroot, mesa, some libs, etc. In the end, nix will solve your equation to a system that has everything that you want. Not only packages, also systemd units, your whole
/etc
and so on.It's of course much simpler to imagine it like this. NixOS essentially builds your system from the ground up using a configuration file instead of by running a bunch of commands. Each configuration change produces a new system in the same sense that
4 = x + 3
solves differently than5 = x + 3
. The essential part is that Nix always solves the equation forward, if you will. So whereapt-get install foo-service
would put a line into/etc/groups
, changing the file in place, Nix would replace the whole file because it knows what the file has to look like at all times given the configuration. Further more, it keeps the old configurations around. So if you liked your system better solving for 4 than for 5, you can just go back. Since Nix knows exactly how the system needs to look for 4, there is no "mess" because it does not need to remove things. It always builds forward.Hope that makes some sense :D