  Ni-doped MoS$_2$ is a layered material with useful tribological,
optoelectronic, and catalytic properties. Experiment and theory on doped
MoS$_2$ has focused mostly on monolayers or finite particles: theoretical
studies of bulk Ni-doped MoS$_2$ are lacking and the mechanisms by which Ni
alters bulk properties are largely unsettled. We use density functional theory
calculations to determine the structure, mechanical properties, electronic
properties, and formation energies of bulk Ni-doped 2H-MoS$_2$ as a function of
doping concentration. We find four meta-stable structures: Mo or S
substitution, and tetrahedral (t-) or octahedral (o-) intercalation. We compute
phase diagrams as a function of chemical potential to guide experimental
synthesis. A convex hull analysis shows that t-intercalation (favored over
o-intercalation) is quite stable against phase segregation and in comparison
with other compounds containing Ni, Mo, and S; the doping formation energy is
around 0.1 meV/atom. Intercalation forms strong interlayer covalent bonds and
does not increase the $c$-parameter. Ni-doping creates new states in the
electronic density of states in MoS$_2$ and shifts the Fermi level, which are
of interest for tuning the electronic and optical properties. We calculate the
infrared and Raman spectra and find new peaks and shifts in existing peaks that
are unique to each dopant site, and therefore may be used to identify the site
experimentally, which has been a challenge to do conclusively.
