  Theory predicts that cosmological gas accretion plays a fundamental role
fuelling star formation in galaxies. However, a detailed description of the
accretion process to be used when interpreting observations is still lacking.
Using the state-of-the-art cosmological hydrodynamical simulation eagle, we
work out the chemical inhomogeneities arising in the disk of galaxies due to
the randomness of the accretion process. In low-mass systems and outskirts of
massive galaxies, low metallicity regions are associated with enhanced
star-formation, a trend that reverses in the centers of massive galaxies. These
predictions agree with the relation between surface density of star formation
rate and metallicity observed in the local spiral galaxies from the MaNGA
survey. Then, we analyse the origin of the gas that produces stars at two key
epochs, z simeq 0 and z simeq 2. The main contribution comes from gas already
in the galaxy about 1 Gyr before stars are formed, with a share from external
gas that is larger at high redshift. The accreted gas may come from major and
minor mergers, but also as gravitationally unbound gas and from mergers with
dark galaxies (i.e., haloes where more than 95 % of the baryon mass is in gas).
We give the relative contribution of these sources of gas as a function of
stellar mass (8 < log Mstar < 11). Even at z = 0, some low-mass galaxies form a
significant fraction of their total stellar mass during the last Gyr from
mergers with dark galaxies.
