  Nuclear magnetic resonance (NMR) and nuclear quadrupole resonance (NQR)
spectroscopy of bulk quantum materials have provided insight into phenomena
such as quantum phase criticality, magnetism, and superconductivity. With the
emergence of nanoscale 2-D materials with magnetic phenomena,
inductively-detected NMR and NQR spectroscopy are not sensitive enough to
detect the smaller number of spins in nanomaterials. The nitrogen-vacancy (NV)
center in diamond has shown promise in bringing the analytic power of NMR and
NQR spectroscopy to the nanoscale. However, due to depth-dependent formation
efficiency of the defect centers, noise from surface spins, band bending
effects, and the depth dependence of the nuclear magnetic field, there is
ambiguity regarding the ideal NV depth for surface NMR of
statistically-polarized spins. In this work, we prepared a range of shallow NV
ensemble layer depths and determined the ideal NV depth by performing NMR
spectroscopy on statistically-polarized \fluorine{} in Fomblin oil on the
diamond surface. We found that the measurement time needed to achieve an SNR of
3 using XY8-N noise spectroscopy has a minimum at an NV depth of 5.4 nm. To
demonstrate the sensing capabilities of NV ensembles, we perform NQR
spectroscopy on the \boron{} of hexagonal boron nitride flakes. We compare our
best diamond to previous work with a single NV and find that this ensemble
provides a shorter measurement time with excitation diameters as small as 4
$\mu$m. This analysis provides ideal conditions for further experiments
involving NMR/NQR spectroscopy of 2-D materials with magnetic properties.
