One ecosystem. Different layers.
Nix is both a package manager and the name of the language used to describe builds. The manager evaluates expressions, obtains dependencies, and realizes build outputs in the store.
Nixpkgs is a repository of package definitions and supporting libraries. A package attribute such as hello selects a definition from this collection; it is not simply the name of a downloaded archive.
Next section: NixOS takes the idea further.NixOS takes the idea further.
NixOS is a Linux distribution that uses Nix to construct its system configuration: packages, services, users, and much more. Nix on another distribution manages Nix packages; it does not take over that distribution’s system configuration.
Flakes, which we reach in chapter three, give a Nix project a common entry point and a way to lock its inputs. They are neither an operating system nor a replacement for Nixpkgs.
# On a machine with Nix installed
nix --version
# Nix is usable without installing NixOS.
Nix is the tool and language; Nixpkgs is the package collection; NixOS is the distribution.