NixOS: Difference between revisions

imported>HLandau
imported>HLandau
Line 177: Line 177:


=== Usage of the Nix Store ===
=== Usage of the Nix Store ===
A lot of confusion for newcomers arises from the fact that configuration is stored in the read-only nix store along with all the installed packages. This fact makes it impossible to manually edit system configuration, all configuration changes must be performed by editing the ''/etc/nixos/configuration.nix'' file. NixOS provides the Modules System for editing all required configurations. Users should first check if an option for the configuration they require already exist before manually adding files or configuration via low-level NixOS features like activation scripts.
A lot of confusion for newcomers arises from the fact that configuration is stored in the read-only <code>/nix/store</code> tree along with all the installed packages. This fact makes it impossible to manually edit system configuration; all configuration changes must be performed by editing the <code>/etc/nixos/configuration.nix</code> file and executing <code>nixos-rebuild switch</code>. NixOS provides the [[NixOS Modules System|modules system]] for editing all required configurations. Users should first [https://nixos.org/nixos/options.html# check if an option] for the configuration they require already exists before attempting to manually add files or configuration via low-level NixOS features like activation scripts.


The system purity makes it possible to share system configuration without the need to edit multiple files. If you provide the same inputs, same version of '''nixpkgs''' and '''configuration.nix''' you will get the exact same booted system once deployed.
The system purity makes it possible to keep system configuration in a central place, without the need to edit multiple files. This configuration can be distributed or version controlled as desired. It also provides for determinism; if you provide the same inputs, the same version of <code>nixpkgs</code> and the same <code>/etc/nixos/configuration.nix</code> you will get the exact same system state.


=== Modules ===
=== Modules ===