  Let $G$ be a compact connected Lie group. We show that the category
$\mathbf{Loc}_{\infty}(BG)$ of $\infty$-local systems on the classifying space
of $G$, can be described infinitesimally as the category
$\mathbf{InfLoc}_{\infty}(\mathfrak{g})$ of basic $\mathfrak{g}$-$L_\infty$
spaces. Moreover, we show that, given a principal bundle $\pi \colon P
\rightarrow X$ with structure group $G$ and any connection $\theta$ on $P$,
there is a DG functor $$\mathcal{CW}_{\theta} \colon
\mathbf{InfLoc}_{\infty}(\mathfrak{g}) \longrightarrow
\mathbf{Loc}_{\infty}(X), $$ which corresponds to the pullback functor by the
classifying map of $P$. The DG functors associated to different connections are
related by an $A_\infty$-natural isomorphism. This construction provides a
categorification of the Chern-Weil homomorphism, which is recovered by applying
the functor $\mathcal{CW}_{\theta}$ to the endomorphisms of the constant local
system.
