Flakes are referred using an URL-like syntax that is documented here.
Flake URL
- Use a local directory as flake input
-
Rapid Introduction to Nix
URL-like syntax used by the
url
attributeThe
nix build
command takes as argument a value of the form<flake-url>#<package-name>
. By default,.
(which is a flake URL) refers to the current flake. Thus,nix build .#cowsay
will build thecowsay
package from the current flake under the current system.nix build
produces a./result
symlink that points to the Nix store path containing the package: -
First steps with Nix
A registry is simply a mapping of flake alias to Flake URL.
You are not required to use a registry. Without a registry, getting a package off nixpkgs would instead involve its fully qualified URL:
[!info]
nix run
nix run
command will run the specified package from the flake. Herenixpkgs
is the flake, followed by the letter#
, which is followed by the package (Derivation) namecowsay
that is outputted by that flake. See Flake URL for details on the syntax.nixpkgs is not the only way to get software packaged by Nix. As you have seen immediately above, you can install programs from any flake by specifying its flake URL to the
nix ?
commands. For example, Emanote (which is used to build this very website) can be executed or installed directly off its flake on GitHub: