I’ve been fooling with this today and I almost just want to sanity check my understanding because of how often these change. Not complaining about changes JFC.
I’m just over here thinking nix-env and nix profile are mortal enemies that blow up your environment if you accidentally mix them; so I’m just making sure that this is the expected pattern.
I’d say you’re actually correct! nix-env --switch-profile $profile really is just:
ln -sf $profile $HOME/.nix-profile
And no there’s no extra ‘activate’ step. If you check the source code you can see:
This would remain true as long as generations work like the current design.
nix-env has two sides. One side is, as you mentioned, installs and uninstalls stuff from a profile and is the mortal enemy of nix profile. The other side with --set, --list-generations, etc. just juggles around a bunch of symlinks, which you can pretty much replicate with a few shell commands (or in this case, a single one).