  The transference principle of Green and Tao enabled various authors to
transfer Szemer\'edi's theorem on long arithmetic progressions in dense sets to
various sparse sets of integers, mostly sparse sets of primes. In this paper,
we provide a transference principle which applies to general affine-linear
configurations of finite complexity. We illustrate the broad applicability of
our transference principle with the case of almost twin primes, by which we
mean either Chen primes or "bounded gap primes", as well as with the case of
primes of the form $x^2+y^2+1$. Thus, we show that in these sets of primes the
existence of solutions to finite complexity systems of linear equations is
determined by natural local conditions. These applications rely on a recent
work of the last two authors on Bombieri-Vinogradov type estimates for
nilsequences.
