Search code examples
nixnixos

What nix channel is subscribed to by default


I installed the nix package manager on my machine (macOS 10.12.6 Sierra) several weeks ago.

I want to update mylocal nixpkgs collection to bring it in sync with any upstream updates in the channel. My understanding is that this can be achieved by running: nix-channel --update. However when I run this I get the following output:

unpacking channels... created 0 symlinks in user environment

Suggesting no expressions were updated in the channels my system is subscribed to. If I run nix-channel --list I don't see any channels listed. What channel is my system subscribed to by default? and should I expect it to be listed?

Is it the case that generally nix-channel --update will only produce local changes if I have modified the channels I'm subscribed to or if I'm subscribed to the unstable channel?


Solution

  • The following might be specific to OSX:

    Nix channels are managed on a per-user basis (source). nix-channel --list's output is empty because by default you are not subscribed to any channels - only root is subscribed to nixpkgs-unstable (source).

    You can run nix-channel --list as root to see his subscriptions. But

    1. do not run it through sudo (see: https://github.com/NixOS/nix/issues/1548) and
    2. do not use a simple sudo su because it doesn't load /etc/profile (source) and thus will not have the nix env variables set up (variables-setup).

    Working example:

        user$ nix-channel --list
    
        user$ sudo su -
        root# nix-channel --list
        nixpkgs https://nixos.org/channels/nixpkgs-unstable