Overview of the NixOS Linux distribution: Difference between revisions

Update nixos channel
Klinger (talk | contribs)
m →‎Declarative Configuration: git is recommended and common. git in not just possible.
Line 26: Line 26:
=== Declarative Configuration ===
=== 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 specifies the entire system state, including which packages should be installed and all the various system settings and options. This configuration file is normally located at <code>/etc/nixos/configuration.nix</code> (although another location may be specified using the environment variable <code>NIX_PATH</code>, or using <code>nixos-rebuild</code>'s <code>-I</code> option to override the <code>&lt;nixos&gt;</code> [https://nixos.org/manual/nix/stable/language/constructs/lookup-path lookup path]); after the configuration file is modified, the new configuration is then made active by running <code>nixos-rebuild switch</code>. The switch is atomic and can be rolled back if necessary. The configuration files under <code>/etc/nixos</code> may even be kept in a version control system such as Git if desired.
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 specifies the entire system state, including which packages should be installed and all the various system settings and options. This configuration file is normally located at <code>/etc/nixos/configuration.nix</code> (although another location may be specified using the environment variable <code>NIX_PATH</code>, or using <code>nixos-rebuild</code>'s <code>-I</code> option to override the <code>&lt;nixos&gt;</code> [https://nixos.org/manual/nix/stable/language/constructs/lookup-path lookup path]); after the configuration file is modified, the new configuration is then made active by running <code>nixos-rebuild switch</code>. The switch is atomic and can be rolled back if necessary. Most users keep the configuration files under <code>/etc/nixos</code> in a version control system such as Git.


Conventional distributions require users to manually modify configuration files, but these changes are not tracked. If distributions change the default contents of configuration files, these changes often have to be manually merged by users if they have previously modified the file, or the distribution modifications may not be integrated at all, leading to undesired configuration drift. Configuration settings and changes are rarely recorded in a version control system. These shortcomings are often rectified after-the-fact if at all by configuration management solutions such as Puppet or Chef. These tools reconcile system configuration with a description of the expected state. However, these tools are not integrated into the operating system design and are simply layered on top, and OS configuration may still vary where an aspect of OS configuration has not been specified in the description of expected state.
Conventional distributions require users to manually modify configuration files, but these changes are not tracked. If distributions change the default contents of configuration files, these changes often have to be manually merged by users if they have previously modified the file, or the distribution modifications may not be integrated at all, leading to undesired configuration drift. Configuration settings and changes are rarely recorded in a version control system. These shortcomings are often rectified after-the-fact if at all by configuration management solutions such as Puppet or Chef. These tools reconcile system configuration with a description of the expected state. However, these tools are not integrated into the operating system design and are simply layered on top, and OS configuration may still vary where an aspect of OS configuration has not been specified in the description of expected state.