Overview of the NixOS Linux distribution: Difference between revisions
imported>Ixxie |
imported>Ixxie |
||
Line 10: | Line 10: | ||
One of NixOS's most distinguishing features is the ability to ''declaratively configure'' the whole system. This is done by specifying a configuration file which defines which packages are installed on the system, which services to run and various other settings and options. This file is normally called <code>configuration.nix</code> and is found by default at <code>/etc/nixos</code>, although another location can be set using the environment variable <code>NIX_PATH</code>. The system configuration is then built with the command <code>nixos-rebuild</code>. The official website has search tools for browsing the available [https://nixos.org/nixos/options.html# configuration options] and [https://nixos.org/nixos/packages.html packages] (with the exception of proprietary packages). | One of NixOS's most distinguishing features is the ability to ''declaratively configure'' the whole system. This is done by specifying a configuration file which defines which packages are installed on the system, which services to run and various other settings and options. This file is normally called <code>configuration.nix</code> and is found by default at <code>/etc/nixos</code>, although another location can be set using the environment variable <code>NIX_PATH</code>. The system configuration is then built with the command <code>nixos-rebuild</code>. The official website has search tools for browsing the available [https://nixos.org/nixos/options.html# configuration options] and [https://nixos.org/nixos/packages.html packages] (with the exception of proprietary packages). | ||
The following is an example of a <code>configuration.nix</code> file: | The following is an example of a <code>configuration.nix</code> file: |
Revision as of 19:04, 2 September 2017
NixOS is a Linux distribution based on the Nix Package Manager. It supports reproducible and declarative system-wide configuration management as well as atomic upgrades and rollbacks. Alongside this declarative operation mode, NixOS supports imperative package and user management. In NixOS, all components of the distribution - including the kernel, system packages and configuration files - are built by Nix from purely functional Nix Expressions. Since Nix supports binary caching, this provides a convenient compromise between source-based and binary approaches, allowing the use of a binaries for standard components while allowing the user to customize packages and modules when needed. Stable NixOS releases are delivered biannually, with the latest stable version being 17.03. NixOS was created by Eelco Dolstra and Armijn Hemel, and initially released in 2003. It is community developed and maintained under the stewardship of the NixOS Foundation.
Usage
Installation
Declarative Configuration
One of NixOS's most distinguishing features is the ability to declaratively configure the whole system. This is done by specifying a configuration file which defines which packages are installed on the system, which services to run and various other settings and options. This file is normally called configuration.nix
and is found by default at /etc/nixos
, although another location can be set using the environment variable NIX_PATH
. The system configuration is then built with the command nixos-rebuild
. The official website has search tools for browsing the available configuration options and packages (with the exception of proprietary packages).
The following is an example of a configuration.nix
file:
{ config, pkgs, ... }:
{
# Import other configuration modules
# (hardware-configuration.nix is autogenerated upon installation)
imports =
[
./hardware-configuration.nix
./my-dev-tools.nix
./my-desktop-env.nix
./etc.nix
];
# Name your host machine
networking.hostName = "mymachine";
# Define user accounts
users.extraUsers =
{
myuser =
{
home = "/home/myuser";
extraGroups = [ "wheel" "networkmanager" ];
isNormalUser = true;
uid = 1000;
};
};
# Install some packages
environment.systemPackages =
with pkgs;
[
ddate
testdisk
zsh
];
# Enable the OpenSSH daemon
services.openssh.enable = true;
}