The X-ray luminosity function of local galaxies