We use the 2dF Galaxy Redshift Survey to measure the dependence of the bJ-band galaxy luminosity function on large-scale environment, defined by density contrast in spheres of radius 8 h−1 Mpc , and on spectral type, determined from principal component analysis. We find that the galaxy populations at both extremes of density differ significantly from that at the mean density. The population in voids is dominated by late types and shows, relative to the mean, a deficit of galaxies that becomes increasingly pronounced at magnitudes brighter than MbJ−5log10h≲−18.5 . In contrast, cluster regions have a relative excess of very bright early-type galaxies with MbJ−5log10h≲−21 . Differences in the mid- to faint-end population between environments are significant: at MbJ−5log10h=−18 early- and late-type cluster galaxies show comparable abundances, whereas in voids the late types dominate by almost an order of magnitude. We find that the luminosity functions measured in all density environments, from voids to clusters, can be approximated by Schechter functions with parameters that vary smoothly with local density, but in a fashion that differs strikingly for early- and late-type galaxies. These observed variations, combined with our finding that the faint-end slope of the overall luminosity function depends at most weakly on density environment, may prove to be a significant challenge for models of galaxy formation.