Default channel for users in a NixOS system?

I’m running NixOS. I’ve explicitly set the NixOS channel as superuser.

❯ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-unstable

However, I’ve never subscribed to any channels as an ordinary user.

❯ nix-channel --list

So when I do something like nix-shell -p somepackage, what channel does it get somepackage from? I assume it defaults to the nixos channel, is that correct?

2 Likes

nix-shell will do the equivalent of import <nixpkgs> {} and use attributes from the resulting set.

And by default there is a NIX_PATH entry that maps nixpkgs to /nix/var/nix/profiles/per-user/root/channels/nixos.

3 Likes