The $\delta$ function is not continuous, so it's a priori not differentiable. In fact, it's not even well-defined as an ordinary real-valued function, but can be made so in terms of distributions - linear maps on a space of test functions given by $f\mapsto\int\delta f=f(a)$.
It's possible to sensibly define derivatives of distributions by looking at representations as limits of functions:
If $\delta_i$ is a family of functions so that $\lim_{i\rightarrow\infty}\int\delta_i(x) f(x)\mathrm dx=f(a)$ for any test function $f$, then it can be considered a representation of the Dirac delta. Now, if we take the family of derivatives $\frac{\mathrm d}{\mathrm dx}\delta_i$ we arrive at
$$
\int\left[\frac{\mathrm d}{\mathrm dx}\delta_i(x)\right]f(x)\mathrm dx=-\int\delta_i(x)\left[\frac{\mathrm d}{\mathrm dx}f(x)\right]\mathrm dx
$$
through integration by parts and using the fact that $f$ has by definition compact support (which makes the boundary term vanish).
As the derivative is linear as well, this defines another linear map $f\mapsto-\int\delta f'$ on the space of test functions, which we call the derivative of our distribution.
Symbolically,
$$
\left[\frac{\mathrm d}{\mathrm dx}\delta(x-a)\right]f(x)=-\delta(x-a)f'(x)
$$
which you can just plug in into your formula above without any need for actual computation as it holds true by definition.