Derivation of relationship between Gibbs free energy and electrochemical cell potential Why is $\Delta G = -nFE$?

I don't understand what the motivation is behind this definition. Was it derived or just given? The textbook provides no justification for this equation. In fact, much of the book associated with the Gibbs free energy provides no justification and just says, 'This is how it is. Now go and solve some problems.'
There are two ways to understand this equation.  

One is to realise that (reversible ideal case) $\Delta G = W_\text{non-exp}$ (non-expansion). Therefore, in an ideal chemical cell, if the potential difference between the electrodes is $E$, to move one mole electrons across the external circuit will be $FE$, which must be equal to the decrease in gibbs free energy of the system. Hence for $n$ mole electrons transferred at the same potential, $W_\text{non-exp} = \Delta G = -nFE$. 

The fact that $\Delta G = W_\text{non-exp}$ can be derived as under:
\begin{align}
\mathrm{d}S 
  &amp;= \frac{\delta q}{T}  &amp;&amp; \text{(reversible case)}\\
\mathrm{d}U 
  &amp;= \delta q + W_\text{non-exp} + W_\text{exp}\\
W_\text{non-exp} 
  &amp;= \mathrm{d}U - W_\text{exp} - \delta q \\
  &amp;= \mathrm{d}U + p\,\mathrm{d}V - T\,\mathrm{d}S 
  &amp;&amp; \text{(const. $p$ and $T$)} \\
  &amp;= \mathrm{d}H - T\,\mathrm{d}S \\
  &amp;= \mathrm{d}G
\end{align}

Another approach is to use 
$$\mu_\mathrm{electrochemical} = \mu_\mathrm{chemical} + zF\phi,$$ 
where $\phi$ is the electric potential at the point, $z$ is the charge on the species. Using this and 
$$\mathrm{d}G_{T,P} = \sum_{i=1}^n \mu_i\,\mathrm{d}n_i,$$
we get the required equation for $z = 1$ for an electron, and considering the electrochemical potential of both the electrodes. I am unsure of a rigorous derivation for the electrochemical potential but Wikipedia has some basics on it.