For CW-complexes, this is spelled out explicitly in Ken Brown's bible (as always): Proposition II.4.1 (which is the combination of Proposition I.4.2 and Proposition II.2.4), after using the algebraic/homological-definition of group cohomology in Section II.3 (effectively we have maps between their explicit $\mathbb{Z}G$-free resolutions of $\mathbb{Z}$ which you can then twist with local coefficients as clarified in Chapter III.1). For general spaces, this is Exercise II.4.2, which he gives hints and furthermore gives the foundational reference that writes it out (Eilenberg--Maclane's 1945 "Relations between homology and homotopy groups of spaces").
More generally, for any path-connected topological space X we can construct a discrete group G and K(G,1) inducing (co)homology isomorphisms, the Kan–Thurston theorem, and then apply the above.