Any Flake bulids (nix build) syntax documentation?

The nix build documentation is sparse, calling the argument an “installables” with a few examples. These examples don’t include the common (to me) use of .#foobar. It also took a good bit of trial and error to figure out how to combine .?submodules=1 with #foobar:

  nix build .#foobar.?submodules=1
  nix build .#foobar?submodules=1
  nix build .#foobar .?submodules=1
  nix build .?submodules=1.#foobar

  nix build .?submodules=1#foobar

Where could I read about the anatomy of the installables string?

See URL-like syntax and Path-like syntax and Flake reference attributes (all in same page).

1 Like

So the . in the common example of nix build .#foo is a path, the # separates a path or url from the output attribute, which is of course the foo, and the parameters (?thing=val) go after the path (.) and before the output attribute. Thanks! I think we could make that more explicit, will consider a PR.

1 Like