Galaxies are intimately connected to the environments they live in. The haloes around them contain the gas reservoir from which the galaxies grow, while galactic outflows heat and enrich this medium with heavy elements. The elemental abundances of present-day stars are, in part, set by these cosmic gas flows. In order to better understand the possible sources for r-process elements, we run cosmological simulations with various models of r-process enrichment included. In this talk I will discuss the resulting r-process abundances in stars formed in several different simulations and with a variety of enrichment models, focusing mostly on neutron star mergers as an r-process site. I will compare these results to observational data and discuss whether or not neutron star mergers can be the only source of r-process elements in the universe.