I wanted to try chaging channels. I did.
nix-channel --add .../nixos-unstable
nix-channel --remove .../nixos-20.09
nix-channel --update
It worked, it created a link and I could run:
nixos-rebuild switch
However, my i3 stopped working correctly so I wanted to turn back to 20.09:
nix-channel --add .../nixos-20.09
nix-channel --remove .../nixos-unstable
nix-channel --update
But now it does not recreate that link and when run
nixos-rebuild switch
it fails with
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
building Nix...
I have searched and tried a few solutions that worked for others like rebooting, running t with sudo -i
but nothing worked so far. How do I recreate that link ?
Ok I found a way: I added the channel with a different name, instead of default nixos-10.09 just nixos
nix-channel --add ..../nixos-20.09 nixos
nix-channel --remove nixos-20.09
nix-channel --update
and lo and behold the link was created and all works again!