Island nucleation in thin-film epitaxy: A first-principles investigation