1.4 KiB
NixOS Configurations
This note covers 21-nixos-configurations/, which defines a full nixosConfigurations output.
1. Module Versus Configuration
04-nixos-module/ shows a reusable module. This example shows the next layer up: a full system definition built with nixpkgs.lib.nixosSystem.
The local module.nix still matters, but now it is only one input into a named machine configuration.
2. What the Flake Exposes
The key output is:
nixosConfigurations.demo
That is the shape other commands expect when you build, inspect, or deploy a NixOS system from a flake.
3. Why the Example Sets Boot and File System Options
Even a small NixOS configuration needs a few system-level settings to evaluate cleanly as a full configuration.
This example sets:
- a host name,
- a root file system,
- a boot loader device, and
system.stateVersion.
Those settings are minimal, and they keep the example focused on flake structure rather than real machine setup.
4. What the Check Verifies
The check reads values from the evaluated configuration and compares them with the expected host name and /etc file contents.
That proves the configuration merges correctly without turning the example into a deployment workflow.
5. Commands to Try
cd 21-nixos-configurations
nix flake show
nix eval .#nixosConfigurations.demo.config.networking.hostName --raw
nix flake check