|
|
| Line 44: |
Line 44: |
| ==== Channels ==== | | ==== Channels ==== |
|
| |
|
| NixOS, as well as Nix packages and NixOS modules are distributed through Nix channels: mechanisms for distributing Nix expressions as well as the associated binary caches for them. These channels are what determine which version of NixOS you are using, and they can be broadly categorized into ''stable'' and ''unstable'' channels, and ''large'' and ''small'' channels. Most users will want the stable/large channel, currently <code>nixos-25.05</code>. For more information on channels and how to choose them, see the [[Channel branches]] article.
| | In the [[Nix ecosystem]], [[Channel branches|channels]] are a mechanism for distributing collections of [[Nixpkgs|Nix packages]] and [[NixOS]] module definitions. A channel represents a curated, versioned set of package definitions and system configurations, typically corresponding to a particular release or the latest available development state. |
|
| |
|
| Like packages installed via <code>nix-env</code>, channels are managed at user-level. NixOS uses the channels set for the <code>root</code> user to update the system-wide configuration; channels set for other users control only the user environment for that user. If you wish to change the channel used by the system-level configuration (<code>/etc/nixos/configuration.nix</code>), ensure you run the correct <code>nix-channel</code> command as root:
| | When using channels, your system or [[User Environment|user environment]] pulls package definitions and options from a URL pointing to a specific snapshot of the Nix Packages collection (Nixpkgs) and associated NixOS modules. |
|
| |
|
| {| class="wikitable"
| | For more information on using and configuring nix channels, refer to [[channel branches]]. |
| |+ Common nix-channel commands
| |
| |-
| |
| |Listing current channels
| |
| |<code>nix-channel --list</code>
| |
| |-
| |
| | Adding a primary channel
| |
| |<code><nowiki>nix-channel --add https://nixos.org/channels/channel-name nixos</nowiki></code>
| |
| |-
| |
| | Adding other channels
| |
| |<code><nowiki>nix-channel --add https://some.channel/url my-alias</nowiki></code>
| |
| |-
| |
| | Remove a channel
| |
| |<code>nix-channel --remove channel-alias</code>
| |
| |-
| |
| | Updating a channel
| |
| |<code>nix-channel --update channel-alias</code>
| |
| |-
| |
| | Updating all channels
| |
| |<code>nix-channel --update</code>
| |
| |-
| |
| | Rollback the last update (useful if the last update breaks the <code>nixos-rebuild</code>)
| |
| |<code>nix-channel --rollback</code>
| |
| |}
| |
| | |
| Note that updating channels won't cause a rebuild in itself; if you want to update channels and rebuild, you can run <code>nixos-rebuild --upgrade switch</code> to do both in one step.
| |
|
| |
|
| == Internals == | | == Internals == |