Context. Dust grains in cold circumstellar regions and dark-cloud interiors at 10-20 K are covered by ice mantles. A nonthermal desorption mechanism is invoked to explain the presence of gas-phase molecules in these environments, such as the photodesorption induced by irradiation of ice due to secondary ultraviolet photons. To quantify the effects of ice photoprocessing, an estimate of the photon absorption in ice mantles is required. In a recent work, we reported the vacuum-ultraviolet (VUV) absorption cross sections of nonpolar molecules in the solid phase. Aims. The aim was to estimate the VUV-absorption cross sections of nonpolar molecular ice components, including CH4, CO2, N2, and O2. Methods. The column densities of the ice samples deposited at 8 K were measured in situ by infrared spectroscopy in transmittance. VUV spectra of the ice samples were collected in the 120-160 nm (10.33-7.74 eV) range using a commercial microwave-discharged hydrogen flow lamp. Results. We found that, as expected, solid N2 has the lowest VUV-absorption cross section, which about three orders of magnitude lower than that of other species such as O2, which is also homonuclear. Methane (CH4) ice presents a high absorption near Ly-α (121.6 nm) and does not absorb below 148 nm. Estimating the ice absorption cross sections is essential for models of ice photoprocessing and allows estimating the ice photodesorption rates as the number of photodesorbed molecules per absorbed photon in the ice.