Hey there!
Home Manager
Whether you want or need Home Manager is entirely up to you; it is completely optional. I don’t see much benefit for myself right now, so I don’t use it either.
Flakes
You might have a look at these two videos which, in my opinion, explain their purpose quite well: namely 1) improving reproducibility and 2) making software more easily and in a more standardized way available. To summarize the first point, per default Nix pulls all software from channels in order to realize your declared configuration. That means the same configuration file can result in different systems depending on the available software of the channel at any given moment in time. Flakes solve that by locking the precise versions. Their basic concept is actually quite simple.
What it means to install software with Nix
Put simply, whenever you install software in NixOS (regardless of the method used) it gets copied to a unique subfolder in the Nix Store (which is just your local directory /nix/store
) and made available to you via so-called Profiles or user environments: you only “see” the applications that are in your default Profile (or that are declared system-wide in the list environment.systemPackages
of your configuration.nix
). A nice explanation can be found in the Nix Reference Manual, entry “Profiles”.
Or in the description of nix-env
of the Nix Reference Manual: “The command nix-env
is used to manipulate Nix user environments. User environments are sets of software packages available to a user at some point in time. In other words, they are a synthesised view of the programs available in the Nix store. There may be many user environments: different users can have different environments, and individual users can switch between different environments.”
So, Profiles (or user environments) are basically a bunch of symlinks to different objects in the Nix Store that define which software is available to you. That means, if you use nix-env -iA <insert_app_name_here>
or even something like
nix run nixpkgs#cowsay hello world
it gets thrown into the Nix Store along all the other software, but is added only to your current user profile (and can’t be accessed by someone else unless they also decide to install it - in which case a symlink to the already available copy is added to their profile as well, so that you don’t have to worry about having the same software twice). If you “uninstall” a specific application, its symlink is removed from your Profile but it still remains in the Nix Store unless you also do a “garbage collection” (GC). Note that profiles act as so-called GC roots: put simply, everything in the Nix Store which is referenced by a link from outside the Store is protected from being garbage-collected. And everytime you install or remove a package a new “generation” of that profile is generated. You can see your profiles in ~/.local/state/nix/profiles
.
If you’re interested in how profiles, the Nix Store and the linking system actually works, I highly recommend watching part of the video “Everyday Use of GNU Guix” (minutes 23 to 37) by Chris Marusich on YouTube. Nix works similar to Guix in this regard. (But the given commands differ.)