  The relative desorption energies of CO and N$_2$ are key to interpretations
of observed interstellar CO and N$_2$ abundance patterns, including the
well-documented CO and N$_2$H$^+$ anti-correlations in disks, protostars and
molecular cloud cores. Based on laboratory experiments on pure CO and N$_2$ ice
desorption, the difference between CO and N$_2$ desorption energies is small;
the N$_2$-to-CO desorption energy ratio is 0.93$\pm$0.03. Interstellar ices are
not pure, however, and in this study we explore the effect of water ice on the
desorption energy ratio of the two molecules. We present temperature programmed
desorption experiments of different coverages of $^{13}$CO and $^{15}$N$_2$ on
porous and compact amorphous water ices and, for reference, of pure ices. In
all experiments, $^{15}$N$_2$ desorption begins a few degrees before the onset
of $^{13}$CO desorption. The $^{15}$N$_2$ and $^{13}$CO energy barriers are 770
and 866 K for the pure ices, 1034-1143 K and 1155-1298 K for different
sub-monolayer coverages on compact water ice, and 1435 and 1575 K for $\sim$1
ML of ice on top of porous water ice. For all equivalent experiments, the
N$_2$-to-CO desorption energy ratio is consistently 0.9. Whenever CO and N$_2$
ice reside in similar ice environments (e.g. experience a similar degree of
interaction with water ice) their desorption temperatures should thus be within
a few degrees of one another. A smaller N$_2$-to-CO desorption energy ratio may
be present in interstellar and circumstellar environments if the average CO ice
molecules interacts more with water ice compared to the average N$_2$
molecules.
