The nature of dark matter, the invisible substance making up over $80%$ of the matter in the Universe, is one of the most fundamental mysteries of modern physics. Ultralight bosons such as axions, axion-like particles or dark photons could make up most of the dark matter. Couplings between such bosons and nuclear spins may enable their direct detection via nuclear magnetic resonance (NMR) spectroscopy: as nuclear spins move through the galactic dark-matter halo, they couple to dark-matter and behave as if they were in an oscillating magnetic field, generating a dark-matter-driven NMR signal. As part of the Cosmic Axion Spin Precession Experiment (CASPEr), an NMR-based dark-matter search, we use ultralow-field NMR to probe the axion-fermion wind coupling and dark-photon couplings to nuclear spins. No dark matter signal was detected above background, establishing new experimental bounds for dark-matter bosons with masses ranging from $1.8times 10^{-16}$ to $7.8times 10^{-14}$ eV.