> WONTFIX
Link to GitHub issue, please?
“Working as intended”
Last time I checked (~year ago) this wordage was still on the documentation page; someone seems to have hit in January. It seems to be missing now though.
Six years with a basic “run this and your path through the documentation stops” issue IMO is a project not worth my time; they clearly don’t want new users.
It's true that the information in that section² of the manual is correct, and also true that those snippets are not instructions, so the manual is not instructing anyone to do a thing that will break their computer... but if some Nix profile is the only thing putting Nix on your PATH and you switch away from that profile, you will naturally no longer have Nix on your PATH, and the next Nix command you try to run will fail. The docs should warn you about that in this section, and the application should also warn you on any actions that might leave your PATH Nixless like this.
There's another problem here, I think only hinted at in that GitHub issue, in that if you switch to an empty or nonexistent profile and start a new shell, the `/bin` path in your profile won't be added to your shell's PATH on shell startup because it doesn't exist. And then when you do install something to that profile, it won't be on your PATH until you start a new shell.
The issue you filed should be reopened as a documentation bug, and a new issue should be created about warning users on operations that might render their PATHs Nixless.
If anyone does hit this or something similar: you can just run nix-env or any other Nix binaries directly from the Nix store, or from one of the other still-existing profile links under /nix/var/nix/profiles, e.g. /nix/var/nix/profiles/per-user/$USER/bin/nix-env, to switch your profile back.
--
1: Namely, Nix users whose Nix binaries are provided in a per-user profile and are running Nix as the relevant users. NixOS users, Nix-Darwin users, System Manager users, users of regular old multi-user Nix installs, and users who install Nix itself via their distro's package manager aren't affected.
2: https://nixos.org/manual/nix/stable/package-management/profi...