The cosmic spectral energy distribution in the EAGLE simulation