nix build

Build a Nix expression (downloading from the cache when possible). See also: tldr nix-build. See tldr nix3 flake for information about flakes. More information: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-build.html.

nix build nixpkgs#pkg

nix build -L .#pkg

nix build ./path/to/directory

nix build --no-link --print-out-paths