NixOS: Difference between revisions
imported>Ixxie No edit summary |
imported>HLandau No edit summary |
||
Line 94: | Line 94: | ||
=== Imperative Operations === | === Imperative Operations === | ||
==== User | ==== User Environments ==== | ||
In addition to declarative system configuration, NixOS offers imperative | In addition to declarative system configuration, NixOS offers the imperative <code>nix-env</code> command which can be used to install packages at the user level. Packages installed using <code>nix-env</code> are only available to the given user, and do not change system state. | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ Common <code>nix-env</code> Commands | |||
|- | |||
|Searching for packages | |Searching for packages | ||
|<code>nix-env -qaP '.*packagename.*'</code> | |<code>nix-env -qaP '.*packagename.*'</code> | ||
Line 118: | Line 119: | ||
==== Channels ==== | ==== Channels ==== | ||
Nix ''channels'' are mechanisms for distributing Nix expressions | Nix ''channels'' are mechanisms for distributing Nix expressions as well as the associated binaries for them; a Nix channel corresponds to a repository in a conventional package management system. Official Nix channels are automatically updated once 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. [https://nixos.org/channels/ A full list of the available official channels is available]. | ||
'' | NixOS is distributed through a number of channels. These NixOS channels can be broadly categorised into ''stable'' and ''unstable'' channels, and ''large'' and ''small'' channels: | ||
* Stable/unstable: | |||
** Stable channels (<code>nixos-17.09</code>) provide conservative updates for fixing bugs and security vulnerabilities, but do not receive major updates after initial release. New stable channels are released every six months. | |||
** Unstable channels (<code>nixos-unstable</code>, <code>nixos-unstable-small</code>) correspond to the main development branch of Nixpkgs, delivering the latest tested updates on a rolling basis. | |||
* Large/small: | |||
** Large channels (<code>nixos-17.09</code>, <code>nixos-unstable</code>) provide binary builds for the full breadth of Nixpkgs. | |||
** Small channels (<code>nixos-17.09-small</code>, <code>nixos-unstable-small</code>) are identical to large channels, but contain fewer binaries. This means they update faster, but require more to be built from source. | |||
Most users will want the stable/large channel, currently <code>nixos-17.09</code>. | |||
NixOS | 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: | ||
{| | {| class="wikitable" | ||
|+ Common nix-channel commands | |||
|- | |||
|Listing current channels | |Listing current channels | ||
|<code>nix-channel --list</code> | |<code>nix-channel --list</code> | ||
Line 157: | Line 156: | ||
|} | |} | ||
Note that | 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</code> to do both in one step. | ||
== Internals == | == Internals == |