Effects of mobile and immobile impurities on two-dimensional nucleation