When in the repository top-level, run nix build .#<attr>. It will look in the legacyPackages and packages output attributes for the corresponding derivation.
nix build .#<attr>
legacyPackages
packages