  We introduce a general framework to describe the stationary state of two
driven systems exchanging particles or mass through a contact, in a slow
exchange limit. The definition of chemical potentials for the systems in
contact requires that the large-deviations function describing the repartition
of mass between the two systems is additive, in the sense of being a sum of
contributions from each system. We show that this additivity property is
satisfied on condition that a macroscopic detailed balance condition holds at
contact, and that the coarse-grained contact dynamics satisfies a factorization
property. However, the nonequilibrium chemical potentials of the systems in
contact keep track of the contact dynamics, and thus do not obey an equation of
state. These nonequilibrium chemical potentials can be related either to the
equilibrium chemical potential, or to the nonequilibrium chemical potential of
the isolated systems. Results are applied both to an exactly solvable driven
lattice gas model, and to the Katz-Lebowitz-Spohn model using a numerical
procedure to evaluate the chemical potential.
