← 返回命令列表

Linux command

nix-channel 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List subscribed channels

nix-channel --list

Add a channel

nix-channel --add [https://nixos.org/channels/nixpkgs-unstable] [nixpkgs]

Update all channels

nix-channel --update

Update a specific channel

nix-channel --update [nixpkgs]

Remove a channel

nix-channel --remove [nixpkgs]

Rollback to a previous channel generation

nix-channel --rollback

List channel generations

nix-channel --list-generations

说明

nix-channel manages Nix channel subscriptions. Channels are URLs that point to a Nix expression tarball providing a set of packages and NixOS modules. The list of subscribed channels is stored in `~/.nix-channels`. After updating, channel expressions are symlinked from `~/.nix-defexpr/` and become available to `nix-env` and other Nix tools. Nix flakes are the modern alternative to channels.

参数

--list
Print names and URLs of all subscribed channels.
--add _URL_ _NAME_
Subscribe to a channel. If _NAME_ is omitted, defaults to the last component of the URL with -stable or -unstable suffixes removed.
--update _NAMES..._
Download Nix expressions of subscribed channels and make them the default for nix-env operations. Optionally update only the named channels.
--remove _NAME_
Unsubscribe from a channel.
--rollback _GENERATION_
Revert the previous call to `--update`. Optionally specify a generation number.
--list-generations
Show channel generations.
--help
Display help information.
--version
Display version information.

FAQ

What is the nix-channel command used for?

nix-channel manages Nix channel subscriptions. Channels are URLs that point to a Nix expression tarball providing a set of packages and NixOS modules. The list of subscribed channels is stored in `~/.nix-channels`. After updating, channel expressions are symlinked from `~/.nix-defexpr/` and become available to `nix-env` and other Nix tools. Nix flakes are the modern alternative to channels.

How do I run a basic nix-channel example?

Run `nix-channel --list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --list do in nix-channel?

Print names and URLs of all subscribed channels.