I've now solved this problem using Cholesky decomposition.
Using the identity:
$\log(\det(A)) = 2 \sum_i \log(F_{ii})$,
where F is the Cholesky root of A.
I've then done the differentiation numerically, by computing $\log(\det(A))$ for two slightly different values of $\lambda$. It turns out that Cholesky decomposition is possible and very fast for my sparse matrices.