  We connect the rare fluctuations of an Equilibrium (EQ) process and the
typical fluctuations of a nonequilibrium (NE) stationary process. In the
framework of large deviation theory, this observation allows us to introduce NE
thermodynamic potentials. For continuous-time Markov chains, we identify the
relevant pairs of conjugated variables and propose two NE ensembles: one with
fixed dynamics and fluctuating time-averaged variables, and another with fixed
time-averaged variables, but a fluctuating dynamics. Accordingly, we show that
NE processes are equivalent to conditioned EQ processes ensuring that NE
potentials are Legendre dual. We find a variational principle satisfied by the
NE potentials that reach their maximum in the NE stationary state and whose
first derivatives produce the NE equations of state, and second derivatives
produce the NE Maxwell relations generalizing the Onsager reciprocity
relations.
