  We investigate the dust composition of detached shells around carbon stars,
with a focus to understand the origin of the cool magnesium-sulfide (MgS)
material around warm carbon stars, which has been detected around several of
these objects. We build a radiative transfer model of a carbon star surrounded
by an expanding detached shell of dust. The shell contains amorphous carbon
grains and MgS grains. We find that a small fraction of MgS dust (2% of the
dust mass) can give a significant contribution to the IRAS 25 micron flux.
However, the presence of MgS in the detached shell cannot be inferred from the
IRAS broadband photometry alone but requires infrared spectroscopy. We apply
the model to the detached-shell sources R Scl and U Cam, both exhibiting a cool
MgS feature in their ISO/SWS spectra. We use the shell parameters derived for
the molecular shell, using the CO submillimetre maps. The models, with MgS
grains located in the detached shell, explain the MgS grain temperature, as
derived from their ISO spectra, very well. This demonstrates that the MgS
grains are located at the distance of the detached shell, which is a direct
indication that these shells originate from a time when the stellar photosphere
was already carbon-rich. In the case of R Scl, the IRAS photometry is
simultaneously explained by the single shell model. In the case of U Cam, the
IRAS photometry is under predicted, pointing to a contribution from cooler dust
located even further away from the star than the molecular shell. We present a
simple diagnostic to constrain the distance of the shell using the profile of
the MgS emission feature. The emission feature shifts to longer wavelength with
decreasing grain temperature. One can therefore infer a temperature and a
corresponding distance to the star from the observed profile. (abridged)
