$ nix-channel --update
unpacking channels...
created 1 symlinks in user environment
It’d be helpful if the output was more like
$ nix-channel --update
unpacking channels...
created 1 symlinks in user environment: /path/to/link -> /path/to/file
So that we can learn what it is doing as we go. As a newb I don’t have an idea what symlink it made.
EDIT: I’m assuming it is one of these:
$ ll /nix/var/nix/profiles/per-user/joe/
total 20
drwxr-xr-x 2 joe joe 4096 Jan 6 13:15 ./
drwxr-xr-x 3 joe joe 4096 Jan 6 13:08 ../
lrwxrwxrwx 1 joe joe 15 Jan 6 13:15 channels -> channels-2-link/
lrwxrwxrwx 1 joe joe 60 Jan 6 13:08 channels-1-link -> /nix/store/5ihyps67n9s330vb2xfbsxbgfl1m0vp1-user-environment/
lrwxrwxrwx 1 joe joe 60 Jan 6 13:15 channels-2-link -> /nix/store/1z56618cvl1q1015dz9pjny00qq1q7hd-user-environment/
lrwxrwxrwx 1 joe joe 14 Jan 6 13:08 profile -> profile-1-link/
lrwxrwxrwx 1 joe joe 60 Jan 6 13:08 profile-1-link -> /nix/store/00sxzkdjx5vm529yqkc2s5zmb9ip711q-user-environment/
It is a bit difficult to adapt this message, as it is pretty generic and appears in many places. You may do not want them all printed on the console.
To dig a bit deeper, you are updating the channels, which means that you are creating a new channels-<id>-link symlink to a new derivation that contains the updated channels.
In my case the interesting channels are stored in root’s profile, for the whole nixos system. The set of channels (channels) points to channels-55-link which in turn points to /nix/store/6338w5976r049z49xq6inaj5xvdaa3s8-user-environment
Note how this derivation is called user-environment. It is the same “user environment” as in the message “created 1 symlinks in user environment”.
To understand the symlink count, you need to expand that path. You then discover that it contains two channels, and the manifest. The manifest is not counted in the list of symlinks as per the source code. In my case, I have two channels and nix-channel --update prints “created 2 symlinks in user environment”.
So the part that print that message has no access to all the /nix/var/nix logic. It just collects named derivations and symlinks the name to the derivation, and adds a manifest.
It’s useful in that it tells me whether the nix-channel --update command actually updated anything (and therefore whether I should rebuild my environment).
I have no idea what I’d ever do with the information about what the actual new symlinks are. If the system breaks, I’d correlate it with when it broke and rollback.
Then I won’t have the output of nix-channel --update on hand to refer to anyway.
I don’t generally do nix-channel --update without rebuilding my environment anyway, but if I did and it broke after a few updates, I can just rollback repeatedly until the environment build works.