Flakes

A flake is a pinned project interface. It declares inputs, records exact input revisions in flake.lock, and exposes outputs that commands can build or inspect.

PartRole
inputs.nixpkgsMain Nixpkgs channel for systems and packages.
inputs.nixpkgs-unstableFast-moving packages, currently used for Zed & Claude Code.
inputs.home-managerUser environment as part of each NixOS system.
inputs.sops-nixSecret material decrypted onto NixOS hosts.
outputs.nixosConfigurationsBuildable NixOS hosts.

The important command target is:

.#nixosConfigurations.<hostname>

nixos-rebuild --flake .#<hostname> is shorthand for selecting one of those host outputs.

Lock File

flake.lock is part of the system definition. Rebuilding without changing it uses the same upstream source graph. Updating it changes package and module inputs, so treat lock updates as intentional system changes.

Use targeted updates when possible:

nix flake lock --update-input nixpkgs-unstable

Use broad updates when the task is a full system refresh:

nix flake update

After changing inputs, evaluate or test one host before switching every host.