Context. The possible presence of amorphous and heterogeneous phases in the inner crust of a neutron star is expected to reduce the electrical conductivity of the crust, potentially with significant consequences on the magneto-thermal evolution of the star. In cooling simulations, the disorder is quantified by an impurity parameter, which is often taken as a free parameter. Aims. We aim to give a quantitative prediction of the impurity parameter as a function of the density in the crust, performing microscopic calculations including up-to-date microphysics of the crust. Methods. A multicomponent approach was developed at a finite temperature using a compressible liquid-drop description of the ions with an improved energy functional based on recent microscopic nuclear models and optimized on extended Thomas-Fermi calculations. Thermodynamic consistency was ensured by adding a rearrangement term, and deviations from the linear mixing rule were included in the liquid phase. Results. The impurity parameter is consistently calculated at the crystallization temperature as determined in the one-component plasma approximation for the different functionals. Our calculations show that at the crystallization temperature, the composition of the inner crust is dominated by nuclei with charge number around Z ≈ 40, while the range of the Z distribution varies from about 20 near the neutron drip to about 40 closer to the crust-core transition. This reflects on the behavior of the impurity parameter that monotonically increases with density reaching up to around 40 in the deeper regions of the inner crust. Conclusions. Our study shows that the contribution of impurities is non-negligible, thus potentially having an impact on the transport properties in the neutron-star crust. The obtained values of the impurity parameter represent a lower limit; larger values are expected in the presence of nonspherical geometries and/or fast cooling dynamics.