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?
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
sudo (see: https://github.com/NixOS/nix/issues/1548) andsudo 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
Your nix-channel --update suggests that you have zero channels in your channel list, not zero packages. You can see your channel configuration with nix-channel --list. You probably need to configure a channel.
The Nix install script currently configures a single channel with the name nixpkgs:
"$nix/bin/nix-channel" --add https://nixos.org/channels/nixpkgs-unstable
So that's the default channel and it should be listed in nix-channel --list after installation, until you nix-channel --remove nixpkgs or rm ~/.nix-channels.
The nix-channel command only updates your Nix expressions. It will not update any package installations. It will only affect future invocations of nix-build, nix-env and everything else that uses $NIX_PATH. (It resembles apt-get update in this respect, or brew update, except nix-channel will not update the installed version of Nix.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With