  Electroweak bosons are sensitive probes of the initial state of heavy-ion
collisions, of which a precise knowledge is required in order to disentangle
initial state effects from phenomena induced by the presence of the
quark--gluon plasma (QGP). The production rate of the Z and W$^\pm$ bosons is
especially sensitive to the nuclear modification of the Parton Distribution
Functions (PDF), and the muonic decays (Z $\rightarrow \mu^+\mu^-$ and W$^\pm
\rightarrow \mu^\pm \nu$) offer medium-blind processes carrying this
information to the detector where it can be directly collected. In this
contribution, new measurements of electroweak bosons in p--Pb collisions at
$\sqrt{s_{_{\rm NN}}}$ = 8.16 TeV and Pb--Pb collisions at $\sqrt{s_{_{\rm
NN}}}$ = 5.02 TeV measured by the ALICE Collaboration are reported. The data
are collected at forward rapidity with the ALICE muon spectrometer and are
compared to theoretical predictions with and without including nuclear
modifications.
