2. Run a Program With Nix
The Nix CLI did a few things:
- It used the
nixpkgs
flake reference to pull in some Nix code and targeted theponysay
flake output (more on this later).
- It built the
ponysay
package and stored the result in the Nix store.
- It ran the executable at
bin/ponysay
from theponysay
package.
In Nix, every program is part of a package. Packages are built using the Nix language. The
ponysay
package has a single program (also calledponysay
) but packages can contain multiple programs as well as man pages, configuration files, and more.
You may have noticed that
nix run
doesn’t require anything like anix install
command. This makes it handy for use cases like shell scripting or experimenting with in-progress tools.