Now the system is the project.
The examples in this chapter apply to an installed NixOS system. On another Linux distribution, keep using Nix for packages and development environments. A NixOS VM is a good place to explore these system changes.
The installer creates a starting configuration, usually under /etc/nixos. Keep its hardware configuration, boot settings, filesystem settings, and existing system.stateVersion. The following is an addition, not a replacement for that generated file.
{ config, pkgs, ... }: {
imports = [ ./hardware-configuration.nix ];
networking.hostName = "workstation";
environment.systemPackages = [
pkgs.git
pkgs.hello
];
# Keep your existing boot, filesystem,
# user, and system.stateVersion settings.
}
Files and databases still live their lives.
NixOS can describe how a service is configured. It does not make the service’s database, your home directory, or every runtime file immutable. Separate configuration management from backups.
Read the configuration as a desired state: this machine has this hostname and these system packages. NixOS translates options into the lower-level files and services that implement it.
NixOS declares system configuration. Mutable data still needs its own backup and migration plan.