Noob: NIX_PATH error on nix-rebuild switch

I’m running NixOS 19.09, and when I try to run nixos-rebuild switch, I’m greeted with a lot of NIX_PATH errors, and I’m not sure how to fix this. How does Nix arrive at the nixpkgs/nixos filename? And why are they all referencing root instead of my own user? As a non-root user on NixOS, what channels should I be using? From what I’ve read, I thought I had to use the nixos channels, which you can see I’ve added from the output of my nix-channel --list command.

Can anyone help steer me in the correct direction? Thanks.

Run the command as root or use sudo.

Exactly the same thing happens…

Do you think it might be the fact that the 19.09 channel has a nixos label for my personal account, but a nixpkgs label for root? Grasping at straws here. :-/

Ah, yes that should also be changed. As root add the channel and call it nixos, then remove nixpkgs channel" and try again.

Unfortunately that seems to have had no effect. I don’t need to run any other command/s after modifying channel settings do I?

you’ll need to update your channels
nix-channel --update

Awesome thanks! That’s fixed it. :slight_smile: