  We consider a nonlocal functional $J_K$ that may be regarded as a nonlocal
version of the total variation. More precisely, for any measurable function
$u\colon \mathbb{R}^d \to \mathbb{R}$, we define $J_K(u)$ as the integral of
weighted differences of $u$. The weight is encoded by a positive kernel $K$,
possibly singular in the origin. We study the minimisation of this energy under
prescribed boundary conditions, and we introduce a notion of calibration suited
for this nonlocal problem. Our first result shows that the existence of a
calibration is a sufficient condition for a function to be a minimiser. As an
application of this criterion, we prove that halfspaces are the unique
minimisers of $J_K$ in a ball, provided they are admissible competitors.
Finally, we outline how to exploit the optimality of hyperplanes to recover a
$\Gamma$-convergence result concerning the scaling limit of $J_K$.
