NixOS: Difference between revisions
imported>Ixxie |
imported>Ixxie Added channel section. |
||
| Line 71: | Line 71: | ||
In addition to declarative system configuration, NixOS offers imperative commands to manage ''user specific'' package management. These operations are managed by the <code>nix-env</code> command line tool. The following is a summary of some common operations that can be performed with it: | In addition to declarative system configuration, NixOS offers imperative commands to manage ''user specific'' package management. These operations are managed by the <code>nix-env</code> command line tool. The following is a summary of some common operations that can be performed with it: | ||
''Common <code>nix-env</code> Commands:'' | |||
{| class="wikitable" | {| class="wikitable" | ||
|Searching for packages | |Searching for packages | ||
| Line 91: | Line 91: | ||
==== Channels ==== | ==== Channels ==== | ||
Nix ''channels'' are mechanisms for distributing Nix expressions alongside the associated binaries for them. Nix channels are automatically updated once a certain tests are passed in Nixpkgs' Hydra instance. | Nix ''channels'' are mechanisms for distributing Nix expressions alongside the associated binaries for them. Official Nix channels are automatically updated once a certain tests are passed in Nixpkgs' Hydra instance. It is also possible to create one's own Nix channels, but here we focus the official channels. A full list of the available official channels is available at [https://nixos.org/channels/ https://nixos.org/channels/], but they can be classified into three main types. | ||
''Channel Types:'' | |||
{| class="wikitable" | {| class="wikitable" | ||
|Stable | |Stable | ||
| Line 107: | Line 107: | ||
| Identical to their normal namesakes, but containing fewer binaries. This means they update faster but require more to be built from source. | | Identical to their normal namesakes, but containing fewer binaries. This means they update faster but require more to be built from source. | ||
|} | |} | ||
NixOS will use the root's channels to update the system wide configuration, and user-specific channels to manage the user environment; this means that you must <code>sudo</code> commands intended to manage the channel your <code>configuration.nix</code> should use. The following are common commands to manage channels on NixOS: | |||
{| class="wikitable" | |||
|Listing current channels | |||
|<code>nix-channel --list</code> | |||
|- | |||
| Adding a primary channel | |||
|<code>nix-channel --add https://nixos.org/channels/channel-name nixos</code> | |||
|- | |||
| Adding other channels | |||
|<code>nix-channel --add https://some.channel/url my-alias</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> | |||
|} | |||
Note that after updating channels, one still has to rebuild with <code>nixos-rebuild switch</code>, but one can also run <code>nixos-rebuild switch --upgrade</code> to update channels and rebuild. | |||
== Internals == | == Internals == | ||