A new geometrical perturbation scheme is developed in order to calculate the electromagnetic fields produced by charged sources in prescribed motion moving in a nonstraight perfectly conducting beam pipe. The pipe is regarded as a perturbed infinitely long hollow right-circular cylinder. The perturbation maintains the pipe’s circular cross section while deforming its axis into a planar space curve with, in general, nonconstant curvature. Various charged source models are considered including a charged bunch and an off-axis point particle. In the ultrarelativistic limit this permits a calculation of the longitudinal wake potential in terms of powers of the product of the pipe radius and the arbitrarily varying curvature of the axial space curve. Analytic expressions to leading order are presented for beam pipes with piecewise defined constant curvature modeling pipes with straight segments linked by circular arcs of finite length. The language of differential forms is used throughout, and to illustrate the power of this formalism, a pedagogical introduction is developed by deriving the theory ab initio from Maxwell’s equations expressed intrinsically as a differential system on (Minkowski) space-time.