  We introduce a derived representation scheme associated with a quiver, which
may be thought of as a derived version of a Nakajima variety. We exhibit an
explicit model for the derived representation scheme as a Koszul complex and by
doing so we show that it has vanishing higher homology if and only if the
moment map defining the corresponding Nakajima variety is flat. In this case we
prove a comparison theorem relating isotypical components of the representation
scheme to equivariant K-theoretic classes of tautological bundles on the
Nakajima variety. As a corollary of this result we obtain some integral
formulas present in the mathematical and physical literature since a few years,
such as the formula for Nekrasov partition function for the moduli space of
framed instantons on $S^4$. On the technical side we extend the theory of
relative derived representation schemes by introducing derived partial
character schemes associated with reductive subgroups of the general linear
group and constructing an equivariant version of the derived representation
functor for algebras with a rational action of an algebraic torus.
