Moduli space of flat bundles

Is there a good place to learn about the structure of moduli stack of flat $G$-bundles on an algebraic curve?

Of course, we're just studying representations of a group $\pi_1(X)\to G$ modulo some conjugation (that's why it should be a stack). Since this is very similar to Galois representations in number theory, I wonder if there's a reference that also explains the similarities and differences between the two cases.

-
There are lots of relevant references here: mathoverflow.net/questions/41174/… –  Kevin H. Lin Dec 17 '10 at 7:42

You have to be a bit careful here. Over $\mathbb{C}$ the stack of representations of $\pi_{1}(X)$ in $G$ and the stack of flat algebraic $G$-bundles on $X$ are isomorphic as complex analytic stacks but are not isomorphic as algebraic stacks. In fact the algebraic structure on the stack of flat $SL_{n}(\mathbb{C})$ bundles on $X$ reconstructs the curve $X$, while the stack of representations of $\pi_{1}(X)$ into $SL_{n}(\mathbb{C})$ depends only on the genus of $X$ and not on the particular curve $X$.