lix/doc/manual/src/package-management/channels.md

51 lines
1.6 KiB
Markdown
Raw Normal View History

2020-07-22 21:17:48 +00:00
# Channels
If you want to stay up to date with a set of packages, its not very
convenient to manually download the latest set of Nix expressions for
those packages and upgrade using `nix-env`. Fortunately, theres a
better way: *Nix channels*.
A Nix channel is just a URL that points to a place that contains a set
of Nix expressions and a manifest. Using the command
2020-07-24 13:46:16 +00:00
[`nix-channel`](../command-ref/nix-channel.md) you can automatically
stay up to date with whatever is available at that URL.
2020-07-22 21:17:48 +00:00
To see the list of official NixOS channels, visit
<https://nixos.org/channels>.
You can “subscribe” to a channel using `nix-channel --add`, e.g.,
2020-07-31 13:43:25 +00:00
```console
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
```
2020-07-22 21:17:48 +00:00
subscribes you to a channel that always contains that latest version of
the Nix Packages collection. (Subscribing really just means that the URL
is added to the file `~/.nix-channels`, where it is read by subsequent
calls to `nix-channel
--update`.) You can “unsubscribe” using `nix-channel
--remove`:
2020-07-31 13:43:25 +00:00
```console
$ nix-channel --remove nixpkgs
```
2020-07-22 21:17:48 +00:00
To obtain the latest Nix expressions available in a channel, do
2020-07-31 13:43:25 +00:00
```console
$ nix-channel --update
```
2020-07-22 21:17:48 +00:00
This downloads and unpacks the Nix expressions in every channel
(downloaded from `url/nixexprs.tar.bz2`). It also makes the union of
each channels Nix expressions available by default to `nix-env`
operations (via the symlink `~/.nix-defexpr/channels`). Consequently,
you can then say
2020-07-31 13:43:25 +00:00
```console
$ nix-env -u
```
2020-07-22 21:17:48 +00:00
to upgrade all packages in your profile to the latest versions available
in the subscribed channels.